locked
Model Updateability RRS feed

  • Question

  • User9039696 posted

    Kinda new to EF

    My boss is expressing concerns about how updating our database' schema might effect the EF models we have.

    Example:  We create a view and bring that into the EF model.  Somewhere down the road, we change the Db view's underlying scripting, but don't change the output fields or their types.  Would we have to update the EF model to facilitate the db changes?

    OR:

    We have a stored proc,  but change the scripting without any change to the input or output values.  Again, do we update the model, too, or will the model pick up the changes automatically.

    I don't know how to answer those questions.  Any help or pointers will be welcome.

    Friday, September 22, 2017 4:50 PM

Answers

  • User1120430333 posted

    Example:  We create a view and bring that into the EF model.  Somewhere down the road, we change the Db view's underlying scripting, but don't change the output fields or their types.  Would we have to update the EF model to facilitate the db changes?

    EF is only looking at the output, and the underlying T-SQL and how it executes is not a factor.

    We have a stored proc,  but change the scripting without any change to the input or output values.  Again, do we update the model, too, or will the model pick up the changes automatically.

    EF is only looking at the input and output, and underlying T-SQL is not a factor on how it is executed.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 22, 2017 6:03 PM

All replies

  • User1120430333 posted

    Example:  We create a view and bring that into the EF model.  Somewhere down the road, we change the Db view's underlying scripting, but don't change the output fields or their types.  Would we have to update the EF model to facilitate the db changes?

    EF is only looking at the output, and the underlying T-SQL and how it executes is not a factor.

    We have a stored proc,  but change the scripting without any change to the input or output values.  Again, do we update the model, too, or will the model pick up the changes automatically.

    EF is only looking at the input and output, and underlying T-SQL is not a factor on how it is executed.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 22, 2017 6:03 PM
  • User9039696 posted

    Great!

    Just to be clear,  if I have view that returns columns A, B, C & D in production and we have to change the way C is computed we  can make that change in the DB and push it to production without having to update the EF model and deploy a new build.  Right?

    Friday, September 22, 2017 6:16 PM
  • User753101303 posted

    Hi,

    Correct. This is basically the same than raw SQL with ADO.NET. That is as long as the change you are doing doesn't require any change to existing SQL statements it is fine.

    Friday, September 22, 2017 6:47 PM
  • User1120430333 posted

    Great!

    Just to be clear,  if I have view that returns columns A, B, C & D in production and we have to change the way C is computed we  can make that change in the DB and push it to production without having to update the EF model and deploy a new build.  Right?

    q

    Yes, but as always, you verify with a test in the test environment before promoting changes to production. 

    Friday, September 22, 2017 7:10 PM
  • User9039696 posted

    chazizzle

    Great!

    Just to be clear,  if I have view that returns columns A, B, C & D in production and we have to change the way C is computed we  can make that change in the DB and push it to production without having to update the EF model and deploy a new build.  Right?

    q

    Yes, but as always, you verify with a test in the test environment before promoting changes to production. 

    Of course, goes without saying.  

    My boss, who admittedly doesn't know anything about EF, raised the question and it's a legit concern.  

    I'm new enough to EF to not know the answer myself so many thanks.

    Friday, September 22, 2017 7:40 PM