Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to do a Insert or Update / Merge / Upsert in LLBLGen

I'd like to do an upmerge using LLBLGen without first fetching then saving the entity.
I already found the possibility to update without fetching the entity first, but then I have to know it is already there.

Updating entries would be about as often as inserting a new entry.

Is there a possibility to do this in one step?
Would it make sense to do it in one step?

Facts:

  • LLBLgen Pro 2.6
  • SQL Server 2008 R2
  • .NET 3.5 SP1
like image 536
StampedeXV Avatar asked Feb 01 '26 15:02

StampedeXV


1 Answers

I know I'm a little late for this, but As I remember working with LLBLGenPro, it is totally possible and one of its beauties is everithing is possible! I don't have my samples, but I'm pretty sure you there is a method named UpdateEntitiesDirectly that can be used like this:

// suppose we have Product and Order Entities
using (var daa = new DataAccessAdapter())
{
    int numberOfUpdatedEntities = 
        daa.UpdateEntitiesDirectly(OrderFields.ProductId == 23 && OrderFields.Date > DateTime.Now.AddDays(-2));
}

When using LLBLGenPro we were able to do pretty everything that is possible with an ORM framework, it's just great! It also has a method to do a batch delete called DeleteEntitiesDirectly that may be usefull in scenarios that you need to delete an etity and replace it with another one.

Hope this is helpful.

like image 106
Ashkan Avatar answered Feb 04 '26 06:02

Ashkan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!