| Author |
Share Topic Topic Search Topic Options
|
Sakar SR
Newbie
Joined: 21-Jul-2010
Location: India
Posts: 39
|
Post Options
Quote Reply
Topic: NumericIdGenerator in winforms Posted: 11-Sep-2012 at 4:22am |
Hello, I implemented the NumericIdGenerator in my winforms application. as per the manual. creating a table for NextId, and entering all the tables name it. but when i run the application it only generating from the GLOBAL field. Is there any setting to be done in config file are set any other aspect to get unique ids for each table. Pleas help, have a nice day.
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 11-Sep-2012 at 8:34am |
Hi Sakar, Are you referring to the DevForce Classic or DevForce 2010 documentation? The only documentation for the NumericIdGenerator sample in DevForce 2010 is here - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-idgenerator. The NumericIdGenerator is a sample implementation of the IIdGeneratorInterface, and can be used "as is" or modified to suit your needs. The sample logic always allocates a whole block of ids to be used globally. To change this you'll need to modify the GetRealIdMap logic and related code. From each UniqueId in the collection passed you can obtain the DataEntityProperty and from that the EntityType to discover which entity types need real ids, and modify the allocation logic and SQL queries as needed. In DevForce 2010 we usually find that Guids make better key fields, since once assigned they are permanent and no temporary-to-real id fixup is required. Database identity columns are another option: id fixup is required, but DevForce handles all the temporary id allocation and fixup for you.
|
 |
Sakar SR
Newbie
Joined: 21-Jul-2010
Location: India
Posts: 39
|
Post Options
Quote Reply
Posted: 14-Sep-2012 at 8:57pm |
|
Hi Kimj,
I am porting my applications from DevForce Classic to DevForce 2010, in classic version we have used pooledNumericId generator to generate primary key values, we want to do the same in this version without altering the data base. is this possible. please let me know is there any othe way to generate unique key value for each table without using the database way, like GUID, Autoincrement etc., our primary field is declared has big integer.
looking for your help. have a nice day.
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 15-Sep-2012 at 11:21am |
|
The IIdGenerator interface in DevForce 2010 is almost unchanged from the interface in DevForce Classic, and you should be able to upgrade your pooled Id code to DevForce 2010 without a problem. The RdbKey and AdoHelper classes are gone, but you can directly use ADO.NET to query and save to your table. See the code in the sample for how the EdmKey and DbProvider are used.
|
 |
Sakar SR
Newbie
Joined: 21-Jul-2010
Location: India
Posts: 39
|
Post Options
Quote Reply
Posted: 15-Sep-2012 at 10:36pm |
Hi Kimj, Thanks for your help. we tried to convert the the pooledNumericId generator, but we could not achieve what we want. I think we left out some thin or other. This the classi version of the pooledNumericId generator in VB.Net www.mediafire.com/?7twmks4e3bicqtzhttp://www.mediafire.com/?7twmks4e3bicqtz Please help to correct this code, to make it suitable for DevForce 2010 version either in C# or Vb.Net. Have a nice day.
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 16-Sep-2012 at 6:14pm |
If you need help converting your DevForce Classic code our Professional Services group is a better resource than tech support. If you don't wish to engage Professional Services, then I would start by changing the Imports statements, and also look at the DF 2010 IIdGenerator interface definition, which does have slight changes. Your pooling logic should not require changes, other than removing the RdbKey and AdoHelper. For more information on the IIdGenerator, see http://drc.ideablade.com/xwiki/bin/view/Documentation/create-custom-id-generation.
|
 |
Sakar SR
Newbie
Joined: 21-Jul-2010
Location: India
Posts: 39
|
Post Options
Quote Reply
Posted: 17-Sep-2012 at 11:44am |
|
Hi Kimj,
Thanks for the support.
We managed to convert the pooledNumericId generator, and every thing went well. Only problem is
If we create five records, and i delete any one of them and save the records, the last NextId holds 5 insisted 4. it takes the deleted record into count.
Is there a way to check the UniqueIdCollection for deleted records, or is there a way to check the EntityAspect of the record, so that i can omit the tempId form entering the pool.
Have a nice day.
|
 |
kimj
IdeaBlade
Joined: 09-May-2007
Posts: 1391
|
Post Options
Quote Reply
Posted: 17-Sep-2012 at 12:57pm |
Unfortunately the UniqueIdCollection doesn't have enough information to allow you to access the entity for which the temp id was assigned. There's also not anything else, such as an EntityManager, provided to the IdGenerator which could help. We might need to open a feature request to support this. For now, the only workaround I can think of is somewhat complicated - it would involve implementing a custom EntityServerSaveInterceptor and storing its EntityManager (or sufficient information for your pooling logic) in a thread local variable, which you would then use in your IdGenerator.
|
 |
Sakar SR
Newbie
Joined: 21-Jul-2010
Location: India
Posts: 39
|
Post Options
Quote Reply
Posted: 17-Sep-2012 at 8:15pm |
|
Hi Kimj,
If this feature is incorporated please let all us know.
Thanks for all your support. Have a nice day and good health.
with love for sakar SR.
|
 |