Can EntityCollection<T> returns DataTable or DataView object ?

Posts   
 
    
Saswat
User
Posts: 12
Joined: 08-Jan-2014
# Posted on: 23-Jul-2014 09:22:31   

Hi I have a entity called Student. I want to retrieve all the records by using EntityColection<Student> object. But I want the return type should be DataTable or DataView as it is necessary for me. How to achieve ?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Jul-2014 09:33:03   

Hi Saswat,

You can use in-memory projections for Entity collections. here is the link for the documentation about that topic, with an example.

You also could use the EntityView(2) object to create such projections. Read this.

David Elizondo | LLBLGen Support Team
Saswat
User
Posts: 12
Joined: 08-Jan-2014
# Posted on: 23-Jul-2014 09:33:32   

I have found following from documentation

You can also use the entity collection's DefaultView property to create an EntityView<T>. This is similar to the DataTable's DefaultView property: every time you read the property, you'll get the same view object back. This is also true for the entity collection's DefaultView property.

I have tried also but it is not returning DataTable's DefaultView property.

Any suggestion ?

Saswat
User
Posts: 12
Joined: 08-Jan-2014
# Posted on: 23-Jul-2014 09:51:07   

Hi daelmo,

If I will create a view in SQL and use TypedView for multiple data collection then ? 
Which is more efficient ? TypedView or Hierarchy Projection ? 
Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 23-Jul-2014 21:29:11   

For fetching the data from the database, a flat view which requires one fetch is more efficient than multiple fetches.