none
code first stored procedure - create only once? RRS feed

  • Question

  • How do I check in code first with entities framework if a stored procedure has been

    created so that it is created only once in code first, and once created, it is not recreated?

    Monday, December 10, 2012 3:24 PM

Answers

  • You could set up a database initializer and then put your code to create the stored procedures in it. The code will only be run when EF is creating/recreating the database, which is dependent on the initializer you have chosen (it sounds like you are looking for DropCreateDatabaseIfModelChanges or CreateDatabaseIfNotExists.

    • Marked as answer by Alexander Sun Thursday, December 20, 2012 7:48 AM
    Tuesday, December 11, 2012 2:06 AM