State-of-the-art Relationships which have Organization Design Key (continued)
Now let us put an alternate model to your Net API – the brand new Firearm . The concept at the rear of it is that each and every Character is only going to features one to Gun and you can vice versa.
I am aware, this is not their regular part-to tackle game. Always, you’d has multiple guns in your directory and you will help you to or a few, however for this case, the RPG character simply will get one to weapon of course, if you prefer to change they, you have got to shed one other.
Next, we need to include another assets towards Character category, particularly brand new Weapon . Do you really already learn how to perform a-one-to-you to definitely relation?
Just like the we extra a different design i would also like to see it as a table regarding the database. So, we need to are the Firearm class because the DbSet towards the DataContext .
Okay, it appears as though we already had everything you in a position to your migration. So, regarding the terminal we particular dotnet ef migrations put Firearm and you will struck get back.
The child/depending front could not getting calculated to your one-to-one matchmaking between ‘Character.Weapon’ and you can ‘Weapon.Character’. To identify the child/founded section of the relationships, arrange brand new international secret property. If the this type of navigations really should not be a portion of the same relationships arrange her or him as opposed to indicating the inverse. Read more