Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Specifying Seed Values on model building

Specifying Seed Values on model building

Scheduled Pinned Locked Moved Database
jsonquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    solomon201
    wrote on last edited by
    #1

    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

    S R L 3 Replies Last reply
    0
    • S solomon201

      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

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      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

      R 1 Reply Last reply
      0
      • S Simon_Whale

        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

        R Offline
        R Offline
        R Giskard Reventlov
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S solomon201

          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

          R Offline
          R Offline
          R Giskard Reventlov
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • S solomon201

            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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            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[^]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups