user1626137
user1626137

Reputation: 243

EF 5.0 Code First dbContext Remove Child

We are testing with a simple Category, Product example. When we use integer for our keys everything works fine. However, we need to use GUID keys. This also works fine until we try to delete a child (Product). We get an exception stating that the foreign key cannot be null. When looking at the table design, the integer keys show as Identity Yes whereas the GUID keys show as Identity No. This is a show stopper right now so any help would be greatly appreciated.

Upvotes: 0

Views: 126

Answers (1)

Corey Adler
Corey Adler

Reputation: 16137

You should set the DatabaseGenerated attribute on those GUIDs, like as shown in the answer to this SO question.

Upvotes: 1

Related Questions