Custom Key Generator
Posted: Mon 20 Sep 2010 22:15
Hi,
I have a stored proc which takes as input the 'table name' and returns the next id (primary key) for that table. I use this to populate the id's before inserting.
I need to call this stored proc before i insert a row to the table. I am hoping i can do this by using a custom class that implements the IKeyGenerator interface and by using this class in the CustomGenerator attribute for the column property.
ex:
[Devart.Data.Linq.Mapping.KeyGenerator.CustomGenerator(ClassName = "CustomIdGenerator", Parameters = new object[] {"Order"})]
Is there a sample for implementing custom id generators based on which i can do this ? I looked up at the documentation and it has very minimal info on using custom id generators.
I have a stored proc which takes as input the 'table name' and returns the next id (primary key) for that table. I use this to populate the id's before inserting.
I need to call this stored proc before i insert a row to the table. I am hoping i can do this by using a custom class that implements the IKeyGenerator interface and by using this class in the CustomGenerator attribute for the column property.
ex:
[Devart.Data.Linq.Mapping.KeyGenerator.CustomGenerator(ClassName = "CustomIdGenerator", Parameters = new object[] {"Order"})]
Is there a sample for implementing custom id generators based on which i can do this ? I looked up at the documentation and it has very minimal info on using custom id generators.