Now let us add another type of design to our Net API – brand new Gun . The theory trailing this really is that each and every Reputation will simply enjoys that Gun and you will vice versa.
I am aware, this isn’t your normal role-to play game. Always, you might has multiple weapons in your collection and equip you to definitely otherwise one or two, however for this example, your own RPG character just will get that firearm incase you would like to switch it, you have got to drop another.
Upcoming, we need to create several other assets on Profile group, namely the brand new Weapon . Are you willing to currently find out how to do a single-to-you to definitely relation?
Since we additional a different design i also want to see it as a dining table on the database. Very, we need to are the Gun group once the DbSet with the DataContext .
All right, it appears as though we currently got that which you able towards migration. Thus, on the critical i particular dotnet ef migrations add Gun and you may struck come back.
The little one/founded side could not feel computed to the that-to-you to relationships between ‘Character.Weapon’ and you will ‘Weapon.Character’. To determine the child/founded region of the dating, arrange this new foreign trick possessions. If these types of navigations really should not be the main exact same relationships configure them instead indicating this new inverse.
Ok. So, this means that we have to describe a specific foreign secret assets. With this new foreign secret, the new database knows where to look for the associated entity.
Inside our example, we truly need the fresh new Firearm are the latest dependent region of the relationships. There must be a nature because of it Firearm . It can’t exist without it.