Bug: bad schema with table per concrete type

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Bug: bad schema with table per concrete type

Post by mindplay » Fri 24 Feb 2012 18:15

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.

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

Post by Shalex » Wed 29 Feb 2012 17:54

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?

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

Post by Shalex » Fri 02 Mar 2012 14:55

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.

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Fri 02 Mar 2012 15:43

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.

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

Post by Shalex » Mon 12 Mar 2012 16:42


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

Post by Shalex » Fri 16 Mar 2012 17:40

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 .

Post Reply