Unit of Work and Business Logic

Posts   
 
    
Posts: 30
Joined: 17-Sep-2006
# Posted on: 07-Sep-2007 11:08:45   

I've got a business logic layer that is using the DataAccessAdapter to perform the necessary operations to update entities, send out required emails, etc.

How do people tend to work this when then using the LLBLGen data source control, when you have a UnitOfWork involved? Do you just pull out the entity that you're expecting, cast it, and then pass it on to the Business logic? Just curious what sort of architecture everyone has found useful!

cheers

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 07-Sep-2007 11:16:03   

Set the LLBLGenProDataSource's property LivePersistence to false and handle the PerformWork event, where you can call the BL method.

Posts: 30
Joined: 17-Sep-2006
# Posted on: 07-Sep-2007 11:46:03   

I knew I could do it that way - just wanted to check whether that was "best practice", I suppose! Thanks

What about in the PerformSelect event? I can't set the ContainedCollection property directly, but the business logic returns an EntityCollection<T> or just a particular entity. (so I can't pass ContainedCollection to the business logic layer to be populated)

Cheers for your help

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 07-Sep-2007 16:23:33   

I can't set the ContainedCollection property directly, but the business logic returns an EntityCollection<T> or just a particular entity. (so I can't pass ContainedCollection to the business logic layer to be populated)

No problem, just fetch the EntityCollection from the BL, and then use e.ContainedCollection.Add() or e.ContainedCollection.AddRange() methods to add the fetched entities, or entityCollection