Table Per Hierarchy problems

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
MartinKip
Posts: 3
Joined: Wed 28 Oct 2015 09:26

Table Per Hierarchy problems

Post by MartinKip » Wed 28 Oct 2015 09:36

Hello,

I have a database model with a base class and two classes that inherit from this base class. I want this to be a Table Per Hierarchy inheritance. Creating this model works fine. The inheritance discriminator is an int. The base class condition and derived class conditions are all provided. But when I use model -> Update Database From Model, and check the Regenerate Storage, the discriminator is not added to the Table. When I dont use Regenerate Storage, the discriminator is added to the Table though.
Also, when I make the base class Abstract, it is not added at all to the Database at all, wich is a problem, because the base class in this model should be abstract.
How can I solve this problem?

Thanks in advance

Martin

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Table Per Hierarchy problems

Post by Shalex » Wed 28 Oct 2015 15:22

MartinKip wrote:when I use model -> Update Database From Model, and check the Regenerate Storage, the discriminator is not added to the Table. When I dont use Regenerate Storage, the discriminator is added to the Table though.
The information about discriminator is stored only in SSDL/MSL, but the Regenerate Storage option recreates SSDL/MSL basing on CSDL.
MartinKip wrote:when I make the base class Abstract, it is not added at all to the Database at all, wich is a problem, because the base class in this model should be abstract.
We cannot reproduce the problem in our environment.
1. Please send us a test model for reproducing. Also specify the actual behaviour and the behaviour you are expecting.
2. Tell us the exact build (x.x.x) of your Entity Developer.

MartinKip
Posts: 3
Joined: Wed 28 Oct 2015 09:26

Re: Table Per Hierarchy problems

Post by MartinKip » Thu 29 Oct 2015 09:48

Hello,
The information about discriminator is stored only in SSDL/MSL, but the Regenerate Storage option recreates SSDL/MSL basing on CSDL.
So if I understand you correct, I cannot add a discriminator Model First, and then regenerate storage, because it will always remove the discriminator? I dont suppose that is meant to happen?

Regarding my other problem, I already solved it using a different way, but thanks anyway :wink:

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Table Per Hierarchy problems

Post by Shalex » Thu 29 Oct 2015 12:53

Discriminator is a setting of SSDL. Regenerate Storage wipes out SSDL and, then, recreates it basing on CSDL. We will investigate the possibility of storing the information about discriminator by Regenerate Storage.

MartinKip
Posts: 3
Joined: Wed 28 Oct 2015 09:26

Re: Table Per Hierarchy problems

Post by MartinKip » Thu 29 Oct 2015 14:46

Hello,

I ran some tests, and I found out in NHibernate the discriminator is added when using regenerate storage but when using Entity Framework, it is not.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Table Per Hierarchy problems

Post by Shalex » Thu 29 Oct 2015 16:12

MartinKip wrote:I ran some tests, and I found out in NHibernate the discriminator is added when using regenerate storage but when using Entity Framework, it is not.
That is correct. NHibernate stores information about discriminator at entity level.

Post Reply