开发者

Entity Framework 4: Is it possible to set up Table-per-hierarchy inheritence from scratch?

开发者 https://www.devze.com 2023-01-28 13:58 出处:网络
I\'ve just started playing with EF4, having used NHibernate since about v0.6. I\'m trying out the model-first approach. I\'ve got an abstract base class with two subclasses that I want to persist with

I've just started playing with EF4, having used NHibernate since about v0.6. I'm trying out the model-first approach. I've got an abstract base class with two subclasses that I want to persist with the TPH strategy, but this doesn't seem to be possible through the designer as there doesn't seem to be a way to set up the storage model and mappings in the way I think it should be. I seem to have the following options:

  1. Edit the stor开发者_Go百科age model in the .edmx by hand.
  2. Let it generate the schema using TPT, fix that and then update the model and fix up the mappings.

Am I missing something obvious, or should I just revert to db-first and/or hope that the Code-first stuff gets a proper release soon.


Unfortunately, there is no possibility to create a new model with TPH in Model First, you should use one of the workarounds.
As for Code First, take a look at this article, it should be helpful.

0

精彩评论

暂无评论...
验证码 换一张
取 消