locked
Entity Framework RRS feed

  • Question

  • User-515183 posted

    Can someone tell me how to publish the updated edmx file on the production server.  I did a file publish and the setting for the build on the edmx file is EntityDeploy this was set up already.  I added a column to sql then updated the edmx file and did a publish copied the model to the server did not work. 

    Thanks in advance

    SB

    Wednesday, November 15, 2017 5:00 PM

Answers

  • User-832373396 posted

    <g class="gr_ gr_27 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="27" data-gr-id="27">Hi</g> <g class="gr_ gr_26 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="26" data-gr-id="26">sbuggle</g>,

    when you're using model first or database first, you can't use Migrations, you generate a DDL script that when executed, creates the database or drops and recreates tables losing any data you had.

    See This link read point number 5.

    "The script that is generated will drop all existing tables and then recreate the schema from scratch. This may work for local development but is not a viable for pushing changes to a database that has already been deployed. If you need to publish changes to a database that has already been deployed, you will need to edit the script or use a schema compare tool to calculate a migration script."

    What I do here, is make the changes to the database and update the model (Right click <g class="gr_ gr_58 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="58" data-gr-id="58">edmx</g> designer, click "update model from database")

    2.- You can configure updates on a ClickOnce installer, any changes made to the <g class="gr_ gr_57 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="57" data-gr-id="57">edmx</g> will be published on your app.

    With regards, Angelina Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 17, 2017 8:27 AM

All replies

  • User-821857111 posted

    The EDMX file is not published as part of the deployed application. It is used for generating classes at compile time. You then deploy the resulting dll.

    Thursday, November 16, 2017 7:47 AM
  • User-832373396 posted

    <g class="gr_ gr_27 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="27" data-gr-id="27">Hi</g> <g class="gr_ gr_26 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="26" data-gr-id="26">sbuggle</g>,

    when you're using model first or database first, you can't use Migrations, you generate a DDL script that when executed, creates the database or drops and recreates tables losing any data you had.

    See This link read point number 5.

    "The script that is generated will drop all existing tables and then recreate the schema from scratch. This may work for local development but is not a viable for pushing changes to a database that has already been deployed. If you need to publish changes to a database that has already been deployed, you will need to edit the script or use a schema compare tool to calculate a migration script."

    What I do here, is make the changes to the database and update the model (Right click <g class="gr_ gr_58 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="58" data-gr-id="58">edmx</g> designer, click "update model from database")

    2.- You can configure updates on a ClickOnce installer, any changes made to the <g class="gr_ gr_57 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="57" data-gr-id="57">edmx</g> will be published on your app.

    With regards, Angelina Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 17, 2017 8:27 AM
  • User1120430333 posted

    I added a column to sql then updated the edmx file and did a publish copied the model to the server did not work. 

    You should have been using database management tools to create the column, like MS SQL Sever DB management tools on the production server.. Then it's a simple thing of deploying the executables to the web server for the application.

    Sunday, November 19, 2017 1:17 PM
  • User-515183 posted

    Thanks

    Tuesday, December 19, 2017 10:36 PM