Тэги:
#software_developmentКомментарии:
Add-Migration succeeded for me, but with some warnings:
The foreign key property 'PokemonCategory.CategoryId1' was created in shadow state because a conflicting property with the simple name 'CategoryId' exists in the entity type, but is either not mapped, is already used for another relationship, or is incompatible with the associated primary key type.
Same goes with PokemonOwner.OwnerId1
Anyone with the same issue?
Hello Teddy, In the DataContext example you have done, there seem to be a composite primary key used and when I was using a singular key i got lost can you provide some guidance
ОтветитьHello, i would like to join your discord channel, i get the message: invite has expired,
ОтветитьThis is the best explanation of EF core that I have ever seen. Thank you!
ОтветитьI believe the popular plural of Pokemon is just "Mons".
ОтветитьMan, i hate it when people say "just copy paste it" without at least explaining it a little bit. Lets stick to the most important error for this: the seed from the github repo is the FINISHED seed of the project (i assume), which is incompatable with the current status of the project (e.g. reviews suddenly have ratings, owners have first and last names etc). If some1 has trouble with it, either remove incompatabilities from the seed code or add those to the models.
ОтветитьHello teddy. I am getting the tables but there's no data inside. Every command got executed without any errors. Can you give me a clue as to what might have happened?
ОтветитьI dont know if the course has been updated, but the seed columns doesn't match with de models. Informations such as Rating, FirstName, Last name in Owner and Review does not exist.
I checked the UML twice and still, seeds does not match.
To seed data from the command line: `dotnet run seeddata`
ОтветитьFor anyone unable to add the SQL server in Visual Studio with an error that says cannot connect or find the SQL server, your connection name may not be the same as the Name in the property window. Instead, click on the "View Connection Properties" in the Server Properties window, and copy the server name instead. Put that in the "Server name" in the connect window in VS
ОтветитьIn this specific scenario, what would be the best way to add additional restrictions to fields? for instance, Max Limit of character of the Country, or the Review integer can only be from 1 to 5?
Ответитьsorry i coppy code file Seed.cs but it error with "review"
Ответитьhah you're so funny 🤣🤣🤣🤣
ОтветитьReally really useful! Thanks !
ОтветитьMaybe you will know the problem. I use AzureSQL and when I try to execute migrate I receive error:
The SELECT permission was denied on the object '__EFMigrationsHistory', database 'master', schema 'dbo'.
Currently still figuring out how to grant access to master. But still no hope.
Man, I'm getting an error on this last step. Does anyone know how to fix it?
ОтветитьHi, Although I create the seed data in the same way, the database is created, all tables are coming, but the data in the tables are not. What could be the problem here?
ОтветитьLets rock with a database
ОтветитьTeddy, thank you man! You have no idea how helpful I'm finding your content to be!
ОтветитьQuestion, is there a way to avoid all this DB creation by sharing a database? it is not easier to share a file of a database?
ОтветитьWhen I copied the seed file from your github I was getting red squiglies under rating for reviews and FirstName and LastName, I don't remember you adding them to the models. Or does this have something to do with the relationships. Maybe I messed up there. IF someone had a similar issue would appreciate any help.
ОтветитьDid you change the Model??? The seed was error
ОтветитьAdd migrations errors, update errors, seed errors... nice course :(
Ответитьwhy we need that seed class plz someone explain how it works? do I need to do the same for my own projects?
ОтветитьThank you for such a cool tutorial. Keep it up🤓👍
ОтветитьThank you sir. This is gold!
Ответитьthis is the best tutorial I've found so far. As another said this is enterprise level and cover a lot of topics. Nice
ОтветитьHello, what is the alternative way if I dont use the Add-Migration? In our task, they say that we need to avoid code first approach with migration.
ОтветитьIs seed class same as migration..
ОтветитьI've spent weeks trying to watch how to connect to database... and everywhere i was getting some kind of error. but with you it was so easy!
ОтветитьSorry, but this is a shit show for new beginners.
ОтветитьAre you using SQL Express Core?
ОтветитьAnyone else get this error 'Owner' cannot be used as a property on entity type 'PokemonOwner' because it is configured as a navigation.
ОтветитьHello Teddy, I really appreciate your effort making these tutorial videos. Your steps really clear and easy to understand. Thank you very much!
ОтветитьWhen you create Rating filed ,it's gave me error
ОтветитьOMG Your tips to the databases (connection string) was so amazing. Love you good works, thank you!
ОтветитьLol.......I remember watching this a year ago and thinking "WTF, how am I ever gonna learn this?". Now, I've just popped back to recap on fluent api many to manys. You're a star, Teddy and to anyone else thinking "How the f**k am I gonna learn this?", you WILL understand it. Just keep practicing under the guidance of Don Ted ;)
ОтветитьAny advice to connect visual studio to sql server running in docker. The sql server object explorer doesn't work and google replies suck
Ответить👍👍
ОтветитьIf you use an local server like he does you can only type "." (a dot without the strings) insteat of copying the whole name
ОтветитьDidn't anyone get errors in the seed file. In the seed file provided in teddy's github link, there are firstname and lastname in the owner. But while creating the owner modal, we didnt include them. Did anyone did something about this?
Ответитьur funny dude
Ответитьif there is database already..do we need to use migration...pls rply sir
ОтветитьHi Teedy i get this exeption when seeding the data:
An exception occurred in the database while saving changes for context type 'BasketballPlayerReviewApp.Data.DataContext'.
System.InvalidOperationException: The value of 'BrandDeal.BrandId' is unknown when attempting to save changes. This is because the property is also part of a foreign key for which the principal entity in the relationship is not known.
It has a problem with many to many relationship. Im doing a diffrent review app but the implemantation is kinda the same as yours. Pls help.
You can use also
using (var seeder = scopedFactory.CreateScope())
{
var service = seeder.ServiceProvider.GetService<Seed>();
service.SeedDataContext();
}
and register Seed as scoped
builder.Services.AddScoped<Seed>();
No need to use CLI to seed then ;)
If facing an error during Add-Migration InitialCreate with build failed then do some changes owner(first name and last name instead of just name ) and review (add ratings)class
ОтветитьGuys if you have a problem with your Add-Migration and nothing helps, make sure you delete the stuff in your Controllers folder in solution explorer. I forgot to delete the WeatherForecast default app controller and it messed up my build
Ответить