locked
code first without edmx model : Does metadataworkspace still usefull ? RRS feed

  • Question

  • Hello community,

    I'm currently trying to migrate from an EDMX object context (generated from the database) to a code first model without any edmx, csdl... file.

    My application is using one database per customer (same database schema for all) so I made something : I've shared the metadataworkspace for all connections to these databases to avoid memory to increase each time a customer connect to its database (because it loaded one metadataworkspace objet per database). So my application works very nice with this trick.

    Now that I'm using code first, I would like to know if metadataworkspace is still used because I don't have any csdl file (and the other files that were used to generate metadataworkspace).

    My question is simple : If I remove my little trick into the code first dbcontext, will I be faced to the memory problem that I encountered with old objectcontext ?

    Thanks,

    Regards

    Friday, February 13, 2015 11:24 AM

Answers

  • Hello insomniak,

    >>My question is simple : If I remove my little trick into the code first dbcontext, will I be faced to the memory problem that I encountered with old objectcontext?

    As far as I know, code first still uses the metadataworkspace to map types between CLR types and database types, and it actually still has these files, you could check this article to get the .edmx file in code first.

    In code first, you could access the metadataworkspace by convert DbContext API to ObjectContext API, for details, you could check this blog written by RoMiller who is the Program Manager for the ADO.NET Entity Framework team at Microsoft.

    So for your question, I think the memory would increase along with the connection number of your customers.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Fred Bao Tuesday, February 24, 2015 4:58 AM
    Monday, February 16, 2015 8:07 AM