Dynamically remove sequence mapping

Posts   
 
    
ssugden
User
Posts: 4
Joined: 17-May-2011
# Posted on: 17-May-2011 00:47:14   

Can I dynamically remove sequence mapping from a column?

We have generated a DAL using LLBLGen targeting an Oracle database which includes mapping sequence names to our ID columns. Triggers are not being used.That DAL is being used in the production solution. All good.

We now wish to use the same DAL for the data migration process from an existing Oracle schema. During data migration there are some ID values that we need to maintain. However, with the sequence mapping those values are being overwritten by LLBLGen when the entity is saved. Makes sense. We could of course create another DAL model just for the migration process that does not include the sequence mapping. But as the DAL is complex we do not want to maintain the two DAL models during development. Can we use the first DAL and somehow dynamically/programmatically remove the sequence mapping for the data migration?

Thank you,

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-May-2011 02:47:39   

What LLBLGen version are you using? Are you using Adapter or SelfServicing?

Anyway I think you can force the value using someEntity.Fields["Id"].ForcedCurrentValueWrite.

David Elizondo | LLBLGen Support Team
ssugden
User
Posts: 4
Joined: 17-May-2011
# Posted on: 17-May-2011 03:51:48   

LLBLGen v3.1.11

We are using Adapter.

Intellisense for the method ForcedCurrentValueWrite says "Used by internal code only. Do not call from your code". Is this ok to use?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-May-2011 05:51:29   

I checked this out. It turns that this is not possible because the field is emitted as ReadOnly. Even if you force the new value, it will be ignored for the insert operation. So, the best advice is: modify your designer, or even better, make a copy of your .llblgenproj and refresh against the migration database, then generate a side DAL project for that purpose. Yes this is what you want to avoid, but is the only and best choice in the horizon. As the DAL is very similar this wont be a maintenance problem IMHO.

David Elizondo | LLBLGen Support Team
ssugden
User
Posts: 4
Joined: 17-May-2011
# Posted on: 17-May-2011 05:54:13   

Thanks for the help.