Page 1 of 1

Bug: bad schema with table per concrete type

Posted: Fri 24 Feb 2012 18:15
by mindplay
Table Per Concrete Type strategy does not work - neither mappings nor schema is generated correctly.

Simple example: classes Bar and Baz both extend Foo.

Generate the schema, you get this:

Code: Select all

-- 
CREATE TABLE dbo.Baz (
   Id INT NOT NULL IDENTITY,
   Notes VARCHAR(MAX) NOT NULL,
   Junk VARCHAR(MAX) NOT NULL,
   CONSTRAINT PK_Baz PRIMARY KEY (Id)
)

CREATE TABLE dbo.Bar (
   Id INT NOT NULL IDENTITY,
   Notes VARCHAR(MAX) NOT NULL,
   Stuff VARCHAR(MAX) NOT NULL,
   CONSTRAINT PK_Bar PRIMARY KEY (Id)
)
Where's the Foo table schema? If you did not mark class Foo as Abstract=True, it's a concrete class, which means you need a table.

Here's the mapping generated for class Foo:

Code: Select all


  
    
      
      
    
    
      
    
  
Discriminator value - what for? There is no discriminator-column for this type of mapping.

Posted: Wed 29 Feb 2012 17:54
by Shalex
1. We have reproduced the mentioned SQL generation and are investigating the issue.
2. Please try using the latest (4.2.138) version of Entity Developer. Is discriminator value added to the class Foo as well?

Posted: Fri 02 Mar 2012 14:55
by Shalex
The bug with the DDL generation for the base non-abstract class when using the Table Per Concrete Type inheritance is fixed. The discriminator-value attribute for this type of mapping is removed. We will post here when the corresponding build of Entity Developer is available for download.

Posted: Fri 02 Mar 2012 15:43
by mindplay
Be sure to use the special "not null" notation in the mappings, as mentioned here:

http://www.devart.com/forums/viewtopic. ... 8849#78849

Simply leaving out the discriminator does not work.

Posted: Mon 12 Mar 2012 16:42
by Shalex

Posted: Fri 16 Mar 2012 17:40
by Shalex
New version of Entity Developer 4.3 is released!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23647 .