none
Multiple EDMX files RRS feed

  • Question

  • Hi,

    I am working on migratiion of our project which uses Oracle to SQL server 2008. I have used SSMA to migrate all objects from Oracle to SQL. The current project uses LLBLCODEGEN, but we would like to move onto Entity Framework. I have read quite a few articles on EDM. We have few packages in Oracle. My plan is to create one EDMX for each of these packages and access objects/SP thru respective context object. Could anyone tell me is this a good way or are there any other good methods to solve my problem.

    Thanks,

     

    Tuesday, June 14, 2011 2:21 PM

Answers

  • I'm a bit unsure what you want now... Is this a new question or is this the same as earlier?

    My first answer was based on the assumption (as i wrote) that the schemas was identical between Oracle and SQL Server, but now you're talking about Oracle only and different EF models based on packages?

    If I understand your question now, you want to have a EF model for different modules (eg. one EF model for Customer related, and one EF model for Order related). This is possible, but if you have the modules are tight coupled, you need to fetch from each context and then merge the resulting data manually in your code. But if the modules doesn't have anything to do with eachother you can separate the model into different EF models without noticable problems.

    I don't have any example for my solution I can publish right now, sorry... It takes some time to create.


    --Rune
    • Marked as answer by GirishKumar76 Monday, June 27, 2011 4:14 PM
    Wednesday, June 15, 2011 7:00 PM

All replies

  • Hi,

    If I have understood you correctly, the Oracle and the SQL Server schema is identical?

    You have two possible solutions for your problem.

    One is the one you're describing, but this may add some complexity to your code, since you have to work with two different models. This will force you to either have DTO's that you present from your DAL (which handles which models it should use) or to have interfaces that describes your entities, and have custom code generation items for each of your models that implements these interfaces in the generated entity classes. I don't have any good examples on this, but it is possible both of these solutions.

    A another and simpler (in my eyes) solution is to use several SSDL against your Conceptual model. I did this in a project I have. What I did was that I did like you did first, added one model for each DBMS into my project in different folders, and the one I decided to be my master in the base folder. I then modified the connectionstring, so that the SSDL part of this is different for the different DBMS connectionstring, but the CSDL and MSL parts was the same for all. So, when I want to connect to different databases with my primary model, I just pass the different connection strings into this and everything works by itself.

    I hope this helps!


    --Rune
    Tuesday, June 14, 2011 8:03 PM
  • Thanks Rune. I have one more question. In my method you said it might lead to complexity. As these Oracle packages are group together for individual modules in the project, so I was thinking of using different edmx file for different packages. Also if I want to get some entity from another edm, I can always create context object and access that entity. Hope I have understood this correctly and this is possible with entity framework. If possible could you please send some example for your solution.

    Thanks,

    Girish

    Wednesday, June 15, 2011 9:50 AM
  • I'm a bit unsure what you want now... Is this a new question or is this the same as earlier?

    My first answer was based on the assumption (as i wrote) that the schemas was identical between Oracle and SQL Server, but now you're talking about Oracle only and different EF models based on packages?

    If I understand your question now, you want to have a EF model for different modules (eg. one EF model for Customer related, and one EF model for Order related). This is possible, but if you have the modules are tight coupled, you need to fetch from each context and then merge the resulting data manually in your code. But if the modules doesn't have anything to do with eachother you can separate the model into different EF models without noticable problems.

    I don't have any example for my solution I can publish right now, sorry... It takes some time to create.


    --Rune
    • Marked as answer by GirishKumar76 Monday, June 27, 2011 4:14 PM
    Wednesday, June 15, 2011 7:00 PM
  • Rune,

    Sorry for the confusion. I was talking about once Oracle packages are migrated to SQL server then could I create EF model for each packages. But you have answered my question. with an example. Thanks again

    Monday, June 27, 2011 4:14 PM