What is the purpose of .edmx files?

69,001

Solution 1

EDMX is Visual Studio's "container" for all things about your Entity Data Model.

It contains all the information that is in the CSDL, SSDL, MSL, plus information about the visual layout of the tables in your Visual Studio designer surface.

The EDMX file is converted into CSDL, SSDL, MSL (typically embedded as resources in your assembly) during the build process. You definitely don't have to distribute or copy the EDMX files anywhere for the app to run.

Update: if you are more interested in a code-based approach, you should check out the code-first CTP for Entity Framework which gets by without any .edmx, .csdl/ssdl/msl files at all.

Solution 2

An .edmx fileis an XML file that defines a conceptual model , a storage model, and the mapping between these models. An.edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically.

Share:
69,001
Anuj Aggarwal
Author by

Anuj Aggarwal

Updated on July 09, 2022

Comments

  • Anuj Aggarwal
    Anuj Aggarwal almost 2 years

    What is the purpose of .edmx files? Reading the CSDL, SSDL, and MSL specifications, it looks to me like .edmx files are used only at design time. Are we meant to distribute it with the other edmx? It seems like we need to distribute the .ssdl and/or .csdl files instead.

  • Anuj Aggarwal
    Anuj Aggarwal over 13 years
    how to read csdl,ssdl,msl in run time. and if we change a schema then how to upgrade tables i.e. if we have edmx(in one table lets Employee etc.) then database wizard generate a script of create employee. if we modify the edmx and add a one table(like Account etc.) and alter a employee table(i.e remove a coloum).what edmx will generate a alter and create script.
  • Ladislav Mrnka
    Ladislav Mrnka over 13 years
    @user: You don't need to read CSDL, SSDL, MSL at runtime. ObjectContext will load and use these information automatically.
  • Anuj Aggarwal
    Anuj Aggarwal over 13 years
    and if we change a schema then how to upgrade tables i.e. if we have edmx(in one table lets Employee etc.) then database wizard generate a script of create employee. if we modify the edmx and add a one table(like Account etc.) and alter a employee table(i.e remove a coloum).what edmx will generate a alter and create script
  • marc_s
    marc_s over 13 years
    @User609291: the EDMX visual designer has a series of functions available from its right-click context menu: "update model from database", and also "Generate database from model"
  • Anuj Aggarwal
    Anuj Aggarwal over 13 years
    sir this problem resolve programmatic-ally.because my scenario i have one edmx(one table) and create database.now i have another edmx(in this add new table,modify old table).how to find the difference b/w to edmx and find difference.how to create or alter tables.
  • marc_s
    marc_s over 13 years
    @user609291: if you want to do all this fully programmatically, you should check out the code-first approach for using Entity Framework (which doesn't use any .edmx, .csdl, .ssdl or .msl file - just code)
  • Ladislav Mrnka
    Ladislav Mrnka over 13 years
    @user: First of all why do you have two EDMXs? You should probably think about your architecture, describe it as a question and get some feedback how to do it right in EF.
  • dst3p
    dst3p over 7 years
    @LadislavMrnka This is old, but hopefully could help someone in the future. There are legitimate cases where a developer might need multiple EDMXs. I'm working right now an a web service that has to read data from a source and write it to a different source. It sounds like this particular situation doesn't warrant 2 EDMXs (or even one), but there is definitely a use case for having more than 1.
  • Shaiju T
    Shaiju T about 6 years
    Difference between storage model and conceptual model ? If conceptual model is the classes generated by EF then what is storage model ?
  • Anurag Choudhary
    Anurag Choudhary over 4 years
    The EDMX file is converted into CSDL, SSDL, MSL - is a wrong statement. There is a utility called EdmGen, which is used to create CSDL, SSDL and MSL. Which are then combined to produce an edmx file. This EDMX file is then read by the text templating file (.tt) file in your code. This creates the Context and the models. (Models as partial classes)
  • Martijn
    Martijn almost 4 years
    @shaijut the storage model is a data store schema. it contains how the data is stored in the database (or any other data storage solution).