Specifying Seed Values on model building
-
Is it possible to specify from the override of onmodelbuilding() the starting value to use for a table primary key and the seed value to use for generating the rest columns? I'm using 4.1 code first
-
Is it possible to specify from the override of onmodelbuilding() the starting value to use for a table primary key and the seed value to use for generating the rest columns? I'm using 4.1 code first
your description doesn't tell us what you are using? what is 4.1 code?
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
your description doesn't tell us what you are using? what is 4.1 code?
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
I think he might mean Entity Framework 4.1. Just a guess.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
Is it possible to specify from the override of onmodelbuilding() the starting value to use for a table primary key and the seed value to use for generating the rest columns? I'm using 4.1 code first
You might start here and read the documentation: Tutorial: Code First with EF 4.1[^]. Maynot have the answer but might point you in the right direction.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
Is it possible to specify from the override of onmodelbuilding() the starting value to use for a table primary key and the seed value to use for generating the rest columns? I'm using 4.1 code first
To add to the rest of the advice; It's a bad idea to tinker with the seed-values. You should NOT be wasting time on having them start from a particular range (like 1). Why? Because the artificial key does not hold information, it is merely a link to another record. It's contents should not be relevant outside that purpose. Ever. Second, having an artificial key does not mean that you no longer need to find the "real" primary key, the combination of (non-identity) fields that make the record unique. Why? Because the user needs to be able to differentiate between the records, based on something else than an artificial identity that holds no information.
Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]