Where i can get TypedList for LLBLGenProDataSource sample code

Posts   
 
    
dotnethao
User
Posts: 10
Joined: 27-Jul-2006
# Posted on: 11-Aug-2006 19:16:17   

Hi,

I want to use llblgenprodatasource to bind typedlist to GridView in asp.net 2.0 (SelfService two-class). The TypedList's structure like :

   company.*, customerid( aggregation.count)
      Note: many-to-one relation exists between customer and company.

How can i implement it (to bind to gridview and get data)? Can you tell me where i can get sample code?

Thanks and wait your reply.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 12-Aug-2006 02:48:38   

There are examples of databinding in the manual under Using the Generated Code -> Databinding at design time and runtime.

dotnethao
User
Posts: 10
Joined: 27-Jul-2006
# Posted on: 12-Aug-2006 06:09:08   

There is only sample code about EntityCollection containertype.

I select the DataContainerType and the type of object, but i can not see any result while running. How to implement performSelect and PerformGetDbCount? can you give me sample code about those implemention? T

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 12-Aug-2006 11:26:11   

dotnethao wrote:

There is only sample code about EntityCollection containertype.

I select the DataContainerType and the type of object, but i can not see any result while running. How to implement performSelect and PerformGetDbCount? can you give me sample code about those implemention? T Thanks.

PerformSelect eventhandlers typically fetch data like you would do it normally, with the exception that all objects needed for the fetch are already provided to you by the eventargs passed in: predicates, typedlist object and other objects you might need in the fetch.

So when you want to fetch a typedlist in a PerformSelect eventhandler, you do:


    protected void LLBLGenProDataSource1_PerformSelect(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs e)
    {
        e.ContainedTypedList.Fill(e.MaxNumberOfItemsToReturn, e.Sorter, e.AllowDuplicates, e.Filter, null, e.GroupBy);
    }

I did made a mistake in the PerformGetDbCountEventArgs object though: flushed . There's no property for the contained TypedList/TypedView object. This is a clear oversight, likely caused by the fact that the scenario to use non-live persistence for typedlists/views isn't that common, as they're readonly anyway, but these properties will be added a.s.a.p. Sorry for that. A workaround for that is to read the TypedList object directly from the datasource object:


    protected void LLBLGenProDataSource1_PerformGetDbCount(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformGetDbCountEventArgs e)
    {
        LLBLGenProDataSource1.TypedList.GetDbCount(e.AllowDuplicates, e.Filter, e.Relations, e.GroupBy);
    }

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 14-Aug-2006 11:37:07   

I re-checked the design docs and it wasn't an oversight pfew.

to do a get dbcount for a typedlist (or typedview) do:

protected void LLBLGenProDataSource1_PerformGetDbCount(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformGetDbCountEventArgs e)
{
    TypedListDAO dao = new TypedListDAO();
    e.DbCount = dao.GetDbCount(e.Fields, null, e.Filter, e.Relations, e.GroupBy, e.AllowDuplicates);
}
Frans Bouma | Lead developer LLBLGen Pro