Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generation of new primary key values
Message
From
11/01/2007 07:14:35
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Generation of new primary key values
Miscellaneous
Thread ID:
01184490
Message ID:
01184490
Views:
79
Hi,

In the Mere Mortals Framework for VFP, the dataaccesbase class has a generateprimarykey() method. In the implementation of this method in the ccursor class, a function in the .dbc or remote server (stored procedure)
is called to generate the primary key.

The actual mechanism to generate the PK value is based on a table that contains the name of the tables in the database and a column that holds the next unique primary key value that can be attributed to a new row.
This offers several advantages that are not available when using @@IDENTITY
(unless there are ways to accomplish this that I'm not aware of):

- you can reserve several primary keys at once (by adding the number of
records you need (integer PK field) for cloning processes etc.

- you can determine increments or ranges of PK values for use in distributed databases (to avoid conflicts when consolidating)

In the MM.Net framework, the Business Objects contain a AutoIncrementCustom property but this autoincrementation only involves ADO.Net incrementing logic

So my question is: how can I get the same control of the primary key generating process as described above ?(use of stored procedure in the database). And where do I have to put the necessary code?

Maybe there's an alternative way by using DefaultObjects that retrieve a new primary key value (calling a custum function of the Databasemanger that in its turn calls a stored procedure in the database.?


Mark
If everything seems to be going well, you obviously don't know what the hell is going on !
Next
Reply
Map
View

Click here to load this message in the networking platform