General information
Category:
The Mere Mortals .NET Framework
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.
>
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only