CreateProjection for empty DefaultView

Posts   
 
    
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 07-May-2010 23:54:18   

LLBL version 2.6 Adapter mode

When using CreateProjection for an entityCollection.DefaultView, it returns an empty Datatable without any schema from propertyProjectors.

Is it possible to return a datatable with schema from propertyProjectors even the DefaultView was empty ??

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-May-2010 09:30:14   

Not possible as far as I know. As a workaround you can add a new empty entity before projecting.

if (entityCollection.Count == 0)
{
     entityCollection.AddNew();
}

Then it should generate the schema you want on the DataTable/DataSet.

David Elizondo | LLBLGen Support Team
mohamed avatar
mohamed
User
Posts: 136
Joined: 10-Mar-2008
# Posted on: 08-May-2010 19:54:29   

Could you please inform me (If possible) why not to draw Datatabe schema in empty Defaultview ??

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-May-2010 02:25:27   

Mmm. I don't know. Why one would want? Anyway you could download runtime library sourcecode and follow the projection code. There is a method called CrateColumns of the DataEntityToDataTableProjector, that can give you an insight in case you want to code your own routine to produce something similar to what you need.

David Elizondo | LLBLGen Support Team