Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Identify TargetPerEntity table without join
 

Pages: 1
LLBLGen Pro Runtime Framework
Identify TargetPerEntity table without join
Page:1/1 

  Print all messages in this thread  
Poster Message
Ian
User



Location:
Hertfordshire, UK
Joined on:
01-Apr-2005 16:37:36
Posted:
511 posts
# Posted on: 24-Nov-2016 03:58:21.  
I want to write a T-Sql query which queries the base table from a TargetPerEntity hierarchy and can identify the leaf type without doing a left join to the leaf tables.

Entity framework adds a column to a base table that stores the type identifier. Is LLBLGen able to similarly do this automatically?

Otherwise, what is an easy way of managing a type field such that its hidden from the client code? For example, it would be good to have the client code not need to set the column when creating an instance of a type from the hierarchy.
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14585 posts
# Posted on: 24-Nov-2016 15:48:26.  
Just fetch the SuperType, you don't need joins, it is polymorphic.

Also you don't need a type field or a discriminator field. The type itself is definitive enough.


  Top
Ian
User



Location:
Hertfordshire, UK
Joined on:
01-Apr-2005 16:37:36
Posted:
511 posts
# Posted on: 30-Jan-2017 20:22:59.  
But surely the query does a join under the covers in order to determine the sub-type?
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14585 posts
# Posted on: 30-Jan-2017 22:53:11.  
If you fetch the SuperType, the framework will fetch the subTypes as well.

If you want to fetch one type only (a subtype), then you can only issue a fetch for the subtype Entity, and the framework will Join to the SuperType table to fetch the required data as well.


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37869 posts
# Posted on: 31-Jan-2017 10:07:06.  
Ian wrote:
I want to write a T-Sql query which queries the base table from a TargetPerEntity hierarchy and can identify the leaf type without doing a left join to the leaf tables.

Entity framework adds a column to a base table that stores the type identifier. Is LLBLGen able to similarly do this automatically?

EF adds that column in code-first scenarios with Target-per-entity-hierarchy scenarios, so they're equivalent to discriminator columns. In target-per-entity scenarios, EF doesn't add a type column
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.