none
EF 4.0 + FX 4.0 in Visual Studio 2012 - Splitting model is still a good practice? RRS feed

Answers

  • Hi,

    For VS 2012 my understanding is that it doesn't merge anything. You still work with a single model. The added feature is that with diagrams you are not forced to show all entities in the same diagram (so as far s I know, this is a change in how the model is handled at design time, it doesn't change anything to how it is handled at runtime). You'll still get the same runtime hit you perhaps had with a single model because you'll load more stuff than when using two models but for this you'll liekly have to test to see what you see in your case...


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    Monday, January 7, 2013 1:32 PM
  • Hi,

    You can use EF5 on .NET 4.0. You will just not get some of the features that are in the framework, such as enum support. So you can use EF5 if you like, rather than 4.

    The splitting of the diagrams is a designer feature, as has already been said it will not help performance of your model. However there are a number of other things that might. Typically the problem with large models is that it takes a long time to do view generation, which happens once the first time the model is used. You can mitigate this by compiling your views when you compile your app. Information on this technique, and others, can be found here: http://msdn.microsoft.com/en-us/data/hh949853. The complexity of the model also comes into it, and the linked document talks about some of the ways to help that as well.

    So the answer to your root question on whether or not you can combine your models again really depends on how they perform when you use the pre-compiled views (and possibly other techniques to improve perf) and I can't really answer that without trying it out or at least looking at the model. There is nothing I know of in EF5 that will just make it work faster on .NET 4.0. The model would be faster on 4.5, and with EF6 we have made some changes that would make them faster as well, but none of that helps you at the moment.

    Let me know if you try combining them, I would be interested in seeing the result. I could possibly help with specific perf issues as well.


    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.


    Monday, January 14, 2013 9:11 PM
    Moderator

All replies

  • Hi,

    For VS 2012 my understanding is that it doesn't merge anything. You still work with a single model. The added feature is that with diagrams you are not forced to show all entities in the same diagram (so as far s I know, this is a change in how the model is handled at design time, it doesn't change anything to how it is handled at runtime). You'll still get the same runtime hit you perhaps had with a single model because you'll load more stuff than when using two models but for this you'll liekly have to test to see what you see in your case...


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    Monday, January 7, 2013 1:32 PM
  • Hi Patrice,

    Thank you very much for your reply.

    Very interesting the fact you confirm me the new VS2012 upgraded features only affect the "design time" area.

    My concern was just about that...

    Since I have optimized the 2 distinct models and behaviors in order to achieve the optimal performance I am just worried that merging all the entities in one single model could affect the general performances at runtime. I have already payed a lot of attention in order to avoid loading stuff I do not need, therefore I would like to make sure the "overhead" of the larger model will not degrade the overall performance.

    Do you have any evidence\studies about that?

    Thank you again

    Alberto

    Monday, January 7, 2013 3:03 PM
  • Hi Alberto,

    I am trying to involve another senior expert into your thread. Please wait the response . Sorry for any inconvenience.

    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.

    Thursday, January 10, 2013 7:54 AM
  • Thank you very much Alexander for your help. I will monitor this post waiting for news.

    Thanks

    Alberto

    Thursday, January 10, 2013 3:16 PM
  • Hi,

    You can use EF5 on .NET 4.0. You will just not get some of the features that are in the framework, such as enum support. So you can use EF5 if you like, rather than 4.

    The splitting of the diagrams is a designer feature, as has already been said it will not help performance of your model. However there are a number of other things that might. Typically the problem with large models is that it takes a long time to do view generation, which happens once the first time the model is used. You can mitigate this by compiling your views when you compile your app. Information on this technique, and others, can be found here: http://msdn.microsoft.com/en-us/data/hh949853. The complexity of the model also comes into it, and the linked document talks about some of the ways to help that as well.

    So the answer to your root question on whether or not you can combine your models again really depends on how they perform when you use the pre-compiled views (and possibly other techniques to improve perf) and I can't really answer that without trying it out or at least looking at the model. There is nothing I know of in EF5 that will just make it work faster on .NET 4.0. The model would be faster on 4.5, and with EF6 we have made some changes that would make them faster as well, but none of that helps you at the moment.

    Let me know if you try combining them, I would be interested in seeing the result. I could possibly help with specific perf issues as well.


    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.


    Monday, January 14, 2013 9:11 PM
    Moderator
  • Hi Glenn,

    Thank you very much for your very exhaustive reply. Now I have all what I was looking for.

    In the immediate future weeks I will be quite busy with the final sprints in the project, therefore it will not be the right time to experiment with the data layer, but I will as soon as possible, and will let you know about the results. After reading from you, Patrice and some other documents on the internet, I expect not to have to pay a lot in terms of performance by merging back the models... but will let you know as soon as I try it.

    As for the EF5+EF6, I have always upgraded my projects in order to adopt the latest technologies, but the support of XP operating systems is a must for this project. Tried with a small client application part of the project, but moving to the EF5 resulted in problems with deployment to XP clients, so I aborted the idea of upgrading.... but this is another story.

    Thank you very much again for help

    Alberto

    Tuesday, January 15, 2013 3:47 AM