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
Table Per Hierarchy problems
Re: Table Per Hierarchy problems
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 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.
We cannot reproduce the problem in our environment.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.
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
Hello,
Regarding my other problem, I already solved it using a different way, but thanks anyway
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?The information about discriminator is stored only in SSDL/MSL, but the Regenerate Storage option recreates SSDL/MSL basing on CSDL.
Regarding my other problem, I already solved it using a different way, but thanks anyway
Re: Table Per Hierarchy problems
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
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.
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
That is correct. NHibernate stores information about discriminator at entity level.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.