locked
how to update large live project already using entity farmework 4.0 to 4.1 RRS feed

  • Question

  • 1) in our DataAccessLayer we  are using EF 4.0 and  ObjectConext

    2) in BusinessLayer we are using DataAccessLayer's ObjectContext through Interface (we just extracted interface from ObjectContext)

    3) we have datamodel classes  as self-tracking entities but in a different layer (Dll) and using them as DTO

    objects between UI, BL and DAL  created using custom t4 to make all entities  serializable (based on the article we pulled from msdn)

    We already have tons of LINQ queries written and working however there are issues that apparently  were resolved in 4.1 and we would like to upgrade.

    My questions are these:

    1) Is this possible to upgrade to 4.1 in our case so existing code would not break and our t4 template would continue to generate serializable self tracking entities as before ?

    2) What are the upgrade steps? I downloaded and installed EF 4.1 but that only resulted in new dll referenced as EntityFramework,

    I understand I can start using it in new projects but how to make new 4.1 features available in existing ef 4.0 based code ?

     

     

     

    Monday, January 9, 2012 1:43 PM

All replies

  • hello.... anyone ?
    Wednesday, January 11, 2012 7:14 PM
  • Hi Vl2,

    Welcome!

    1) I haven't seen any template could generate STE for Code First, so I think it's impossible to upgrade to EF4.1 with STE.

    2) EF4.1 wraps EF4.0 with EntityFramework.dll, the most important for STE is the extensions method, you should override the class, you can use : ((IObjectContextAdapter)myContext).ObjectContext to access ObjectContext.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 12, 2012 7:09 AM
  • Hi Alan,

    thank you for reply !

    We are not doing code first, we building/updating edmx from db and then using

    this t4 template

    http://blogs.msdn.com/b/adonet/archive/2010/05/26/using-binary-serialization-and-viewstate-with-self-tracking-entities.aspx

    to create STE off that edmx.

     

    I am not sure if that would make it upgradable to 4.1 or 4.2 at this ponit but I guess now

    another question is can we upgrade to .net 5, 6 etc and not just how to upgrade to et 4.1.

    Obviously we could rewrite DTO and Db layer but that would more expensive and we would prefer an easier upgrade path.

     

     

    Thursday, January 12, 2012 2:25 PM
  • Hi vl2,

    Thanks for your feedback.

    I afraid there is not an easy way to upgrade. The core for STE is the Context.Extensions.cs class, all type in this class is ObjectSet. As I said, EF4.1 wraps EF4.0, you should rewrite it.

    >> I guess now another question is can we upgrade to .net 5, 6 etc

     I'm not sure what do you mean here, thanks for understanding.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 17, 2012 9:13 AM
  • Hi Alan,

    I mean can we move our project to next version of .net (I guess it will be .net 5, then 6 ?)

    without upgrading our database layer from EF 4.0 to EF 5.0  (i guess there will be EF 5.0 ) ?

     

    Friday, January 27, 2012 4:25 PM