none
EF - Stored procedure and complex type update? RRS feed

  • Question

  • There are many situation when some guys in DB change select statement in SP and unfortunately this king of change is not updated using option ‘Update model from database’. This option only updates input parameters but not output complex types. I know that I can manually edit mapping and click update on each procedure but this would take some time. Why this information is not refreshed? Is there any workaround to update every SP mapping for change in returned complex type?

    Ps. watching investment in EF I’m wondering what about SP and they performance. MS investigate heavily in DB mapping which always be slower than SP. I have a filing that SP are treaded as addition and stands behind mapping to tables – is this a good choose for professional solution?

    Thursday, December 6, 2012 12:06 PM

Answers

  • Sorry, I overlooked your post. Your issue is how to update every SPs at once rather going into the Function Imports and updating it one by one. Right now, I dont see any option to do it like this. If you take some other frameworks or even simple ADO.Net classes and you modify the SP in database engine, you have to handle the related data in code as well. Secondly, you wont be updating all 100 Sps all the time, what will be the frequency?

    Ovais Mehboob

    • Marked as answer by Alexander Sun Thursday, December 20, 2012 7:51 AM
    Friday, December 7, 2012 12:51 AM
  • Hi Dominikj,

    Just as Ovais put it, Entity Framework do not know the specific complex type returned, so you are required to map it manually. You also can submit your idea on this site: http://data.uservoice.com/forums/72025-ado-net-entity-framework-ef-feature-suggestions

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, December 10, 2012 5:16 AM

All replies

  • Hi,

    You can update complex type by following steps

    1. After choosing option "Update model from database" go to function imports.

    2. Right click the function and select Edit

    3. Choose "Get Column Information" and click on "Update" button


    Ovais Mehboob

    Thursday, December 6, 2012 6:18 PM
  • Did you read my whole post? "I know that I can manually edit mapping and click update on each procedure but this would take some time". I have about ~100 SP in project. I understand that best practices is to click on every 100 SP when I want to update the model? It looks like nobody use SP any more or everybody likes manual jobs ;(


    Thursday, December 6, 2012 7:44 PM
  • Sorry, I overlooked your post. Your issue is how to update every SPs at once rather going into the Function Imports and updating it one by one. Right now, I dont see any option to do it like this. If you take some other frameworks or even simple ADO.Net classes and you modify the SP in database engine, you have to handle the related data in code as well. Secondly, you wont be updating all 100 Sps all the time, what will be the frequency?

    Ovais Mehboob

    • Marked as answer by Alexander Sun Thursday, December 20, 2012 7:51 AM
    Friday, December 7, 2012 12:51 AM
  • When we start to think like this we can say that there is no need for LINQ to SQL and EF at all – I can write everything in ADO. I’m using EF because it is faster to map SP and because of RIA Services. I think that good mapping framework should give me compile time check for DB not runtime especially in 4-5 version! Never mind, Thanks for assuring me that there is no option for this.

    Friday, December 7, 2012 7:29 AM
  • Hi Dominikj,

    Just as Ovais put it, Entity Framework do not know the specific complex type returned, so you are required to map it manually. You also can submit your idea on this site: http://data.uservoice.com/forums/72025-ado-net-entity-framework-ef-feature-suggestions

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, December 10, 2012 5:16 AM