Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling Identities
Message
From
15/03/2010 21:14:50
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01454212
Message ID:
01454703
Views:
35
Bob,

the Identity field is not my primary key. I have a Guid as that. Anyhow, forget about the identity field, I was just using it to see how the MM.NET framework works. I am just feeling my way with this framework and trying to work out how to do things I would normally do with VFP.

Do you know how to get the framework's AutoIncrementCustom stuff to work on a column that is not the PK? Or another technique to generate a number that helps in identifying records of people (just in case they have the same name I like to have a customer number as well as the name)?


>Frank,
>
>What you want then is something not suited for an identity column. Personally, I do not see a reason why you would want a user to be able to enter their own number for the PK. I see little upside and significant downside in doing this. An identity column is perfect for creating unique keys just for the purpose of uniqueness. If you want some kind of logic on a unique identifying field then you should not use an identity column.
>
>Alternatively, I would suggest you keep the identity column as your PK and add another field called an alias (or something like that) and make it an alternate key on your table (and validate it in your business object rules as well). Then in your PreSave event you can populate this alias field with the identity value if not already entered by the user. Otherwise leave it alone and let the business rules validate its uniqueness.
>
>Bob
>
>
>>I definitely regenerated everything for the BO. Unfortunately I don't have any other identity fields in my database.
>>
>>This is really just a mental exercise, trying to help me understand the framework better. What I would really like to achieve is display a field on the form (web page) that shows the Agent Number, but also lets the user enter the number. When a new agent is added, if the user leaves that field blank, I would like to generate the next continuous number available, but yet they can use their own numbering scheme if desired by manually entering the values.
>>
>>I see there is an AutoIncrementCustom property, but this seems to only work on PKs and I can't find a way to tell it to use a particular column.
>>
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform