LLBLGenProDataSource and LivePersistence=False

Posts   
 
    
catalint
User
Posts: 4
Joined: 02-Jul-2007
# Posted on: 02-Jul-2007 16:13:58   

I'm trying to work with the LLBLGenProDataSource control in the "disconnected" mode with LivePersistence=false. Could somebody post an example on how to make this work? The documentation comes without a complete example. I'm trying to create a search form where the DS is not loading the collection at page load.

Thanks, Catalin

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 02-Jul-2007 16:33:37   

Hi,

with LivePersistence=false, you have to implement the perfomDbCount, performSelect and performWork events.

there is a quick exemple :


        Private Sub dsMappingSets_PerformGetDbCount(ByVal sender As Object, ByVal e As SD.LLBLGen.Pro.ORMSupportClasses.PerformGetDbCountEventArgs2) Handles dsMappingSets.PerformGetDbCount
            e.DbCount = e.ContainedCollection.Count
        End Sub

        Private Sub dsMappingSets_PerformSelect(ByVal sender As Object, ByVal e As SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs2) Handles dsMappingSets.PerformSelect
            Dim adapter As New DataAccessAdapter

            Using adapter
                adapter.FetchEntityCollection(e.ContainedCollection, e.Filter)
            End Using

        End Sub

        Private Sub dsMappingSets_PerformWork(ByVal sender As Object, ByVal e As SD.LLBLGen.Pro.ORMSupportClasses.PerformWorkEventArgs2) Handles dsMappingSets.PerformWork
            Try
                For Each element As UnitOfWorkElement2 In e.Uow.GetEntityElementsToDelete
                    Dim mappingSet As MlmappingSetEntity = CType(element.Entity, MlmappingSetEntity)
                    MappingController.Delete(mappingSet)
                Next

                For Each element As UnitOfWorkElement2 In e.Uow.GetEntityElementsToUpdate
                    Dim mappingSet As MlmappingSetEntity = element.Entity

                    Aricie.Modules.ModuleLocalizer.Services.EntityHelper.InitEntityUpdate(mappingSet, Me.UserInfo)
                Next

                e.Uow.Commit(New DataAccessAdapter, True)

            Catch ex As Exception
                ProcessModuleLoadException(Me, ex)
            End Try

        End Sub


catalint
User
Posts: 4
Joined: 02-Jul-2007
# Posted on: 02-Jul-2007 17:35:49   

I'm doing something similar but I can't see the results in the grid. Here is my code

    protected void btnLoadOrders_Click(object sender, EventArgs e)
    {
        llbldsOrderHeader.Select();

        llbldsOrderHeader.DataBind();
     }

    protected void llbldsOrderHeader_PerformSelect(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs e)
    {
        e.ContainedCollection.GetMulti(null);
    }

    protected void llbldsOrderHeader_PerformGetDbCount(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformGetDbCountEventArgs e)
    {
        e.DbCount = e.ContainedCollection.Count;
    }

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 03-Jul-2007 10:29:33   

Please try the following:

protected void btnLoadOrders_Click(object sender, EventArgs e)
    {
        llbldsOrderHeader.Refetch = true;
        gridView1.DataSource = llbldsOrderHeader;
     }
catalint
User
Posts: 4
Joined: 02-Jul-2007
# Posted on: 09-Jul-2007 17:49:17   

Still no go rage The data binding is not taking place.

I was wondering if somebody can include a full working sample with LLBL. All sample applications provided with LLBL are using LivePersistence=True which will not work in all scenarios.

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 09-Jul-2007 18:07:44   

Hi,

can you provide some more code from your ascx file. Both code samples from Aurelien and Walaa should work so I suspect there is something wrong with your controls declaration.

As for the full app example, I think you'll find some databinding with livepersistence= false in the HnD (the source code for that very forum), and there will be more detailed samples soon provided with the next release.

Cheers

catalint
User
Posts: 4
Joined: 02-Jul-2007
# Posted on: 09-Jul-2007 18:13:06   

I've got this working by doing all the data binding manually in the grid view control.