Atomic Transactions

Posts   
 
    
FarhadB
User
Posts: 28
Joined: 28-Feb-2011
# Posted on: 15-Mar-2011 07:53:12   

Hi

Is it safe to say that LLBLGen manages atomic transactions or would I need to take care of the on my own?

Regards

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 15-Mar-2011 10:12:14   

LLBLGen uses transactions implicitly when saving multiple entities (e.g. entityCollection) in one call to the framework. But you need to explicitly specify a transactions if you need it over multiple saves (calls).

FarhadB
User
Posts: 28
Joined: 28-Feb-2011
# Posted on: 15-Mar-2011 10:14:42   

Walaa wrote:

LLBLGen uses transactions implicitly when saving multiple entities (e.g. entityCollection) in one call to the framework. But you need to explicitly specify a transactions if you need it over multiple saves (calls).

Hi

I am not sure I undertand you..could you perhaps give a small example?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 15-Mar-2011 10:26:32   

When doing: adapter.SaveEntityCollection(customers); The framework will use a transaction to save all entities within the customers collection.

Otherwise you will need to use a transaction object as detailed here: Transactions

FarhadB
User
Posts: 28
Joined: 28-Feb-2011
# Posted on: 15-Mar-2011 10:35:16   

Walaa wrote:

When doing: adapter.SaveEntityCollection(customers); The framework will use a transaction to save all entities within the customers collection.

Otherwise you will need to use a transaction object as detailed here: Transactions

Thanks...will take a look at it....could I ask you one more thing. In the entity framework within visual studio I am able to modify the data model to a model I want making the underlying data structure irrelevant. Can I do the same in LLBLGen?

Example: I have a delivery table Linked to and address table. I can model it as a single entity.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 15-Mar-2011 11:27:28   

Starting from LLBLGen Pro v.3.0 you can create your model as you like, and you can decide the mappings to the underlying database as you wish too.

Having an entity mapped to more than one table is not recommended. So we only map one entity to one table or view. Although a table can be mapped to more than one entity.

If you want to display data (read only) from more than one table, you can create a TypedList in the Designer.

FarhadB
User
Posts: 28
Joined: 28-Feb-2011
# Posted on: 15-Mar-2011 11:31:46   

Walaa wrote:

Starting from LLBLGen Pro v.3.0 you can create your model as you like, and you can decide the mappings to the underlying database as you wish too.

Having an entity mapped to more than one table is not recommended. So we only map one entity to one table or view. Although a table can be mapped to more than one entity.

If you want to display data (read only) from more than one table, you can create a TypedList in the Designer.

Thanks for this info.....much appreciated......So if I wanted to populate the delivery object model (Includes address table)with info including the address then saving it to the DB, I could do so?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 15-Mar-2011 12:11:36   

You can't use the TypedList for saving. It's for read-only purposes.

Otherwise you'd normally fetch the DeliveryEntity with a prefetchPath to the AddressEntity, and thus both would be fetched in one graph, and you can use that for databinding. And then when you save the graph recursively, all changes made to the entities would be saved.