質問

I want to derive TimeCondition entity from Condition entity, so I created this model (with abstract Condition):

enter image description here

but on validation, it says:

Error 3 Error 159: EntityType 'SHomeModel.Store.TimeCondition' has no key defined. Define the key for this EntityType. E:\proj\SmartHome.edmx 126

How can I define TimeCondition's key to be Condition's Id ?

役に立ちましたか?

解決

Note that your table in database should have primary key but in EDMX file you should remove it from your child entity to let it to use parent's key!

More details on MSDN

他のヒント

You have to give Condition's Id to the TimeCondidtion as a foreign key. And then update the Entity model.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top