Often a one-to-one relationship is required. Mapping these in EF is very similar to mapping any other relationships. For this example each person can have one car, and each car must belong to one and only one person.
This doesn’t work. The generated migration wants CarId to be a foreign key.
If we update the mapping to include a key name, we get the correct result. A column named PersonId is created even though it is not specified in our model.
An alternative approach to this is to use PersonId as the primary key on the cars table. This more than likely will not make much sense in your business domain, but it is possible.
Coming from a background with string static type checking, I am often very happy with the loseness of JavaScript. Working with this TypeScript interface, an...
While building Aurelia applications, I have occassionaly made changes that cause the gulp build process to crash. It is very easy to add console logging to ...
Leave a Comment