Page 1 of 1

Table Per Hierarchy problems

Posted: Wed 28 Oct 2015 09:36
by MartinKip
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

Re: Table Per Hierarchy problems

Posted: Wed 28 Oct 2015 15:22
by Shalex
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.

Re: Table Per Hierarchy problems

Posted: Thu 29 Oct 2015 09:48
by MartinKip
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:

Re: Table Per Hierarchy problems

Posted: Thu 29 Oct 2015 12:53
by Shalex
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.

Re: Table Per Hierarchy problems

Posted: Thu 29 Oct 2015 14:46
by MartinKip
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.

Re: Table Per Hierarchy problems

Posted: Thu 29 Oct 2015 16:12
by Shalex
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.