Identity on field

Posts   
 
    
DennisRP
User
Posts: 3
Joined: 28-Nov-2007
# Posted on: 10-Jan-2008 17:17:59   

Hi, Im in a dilemma.

I have a table with translations on different languages for my site. It doesnt have identity on PK (id) because I need to manually create ids. This is what current DAL reflects.

Now I am developing a small project which needs to insert new texts into text table, and therefore needs the identity feature to make an auto-increment.

I sometimes have freelance work on my site, and it becomes annoying if I manually need to switch identity on/off each time I build a DAL.

My code is as follows:

_TextEntity = new TextEntity(); _TextEntity.StrText = description;

_TextEntity.Save() // Since identity is off in DAL, _TextIdentity will not have an .Id value.

int newTextId = _TextEntity.Id; // returns 0

How can I solve this? I have tried using Refetch(), but without succes. Is it possible to ignore identity flag on dbo.Text when generating DAL somehow?

I am using LLBLGen Pro 1.0.2004.2 Final (June 10th, 2005). Solution is ASP.NET 2.0, and Im using SelfServicing. Database is SQLServer 2000.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Jan-2008 22:35:52   

Hi Dennis,

LLBLGen retrieves the identity metadata information from the Database, so if the field is identity in the database, this will become identity ON in LLBLGenPro.

If the field isn't identity, you could opt for set it to identity ON (at LLBLGen Designer) and select a database-side Sequence.

If you don't have (or don't want) to use a database sequence, you have to write your own .netCode-side autoincrementalID code. LLBLGen wont generate the Id's for you.

Please let us know if we can help you further wink

David Elizondo | LLBLGen Support Team