Search code examples
asp.net-web-apiodataasp.net-web-api-odata

How do you build OData IEdmModel from Entity Framework model


The title says it all really. I've found several blogs with different ways (serializing the EF model to XML and then de-serializing again to the IEdmModel was one) but they're all based on old version of the OData package.


Solution

  • Serializing is the only way.

    I've ranted about this a few months ago. AFAIK nothing changed since then, and I personally don't expect them to change too much. The short story is that as of September 2012, there is no plan to use EdmLib in EF, nor is there to use EF's code in other projects.

    How much should we align with OData’s EdmLib?

    Not worth adopting code
        Cost of implementing SSDL & MSL
        Freedom to evolve our API independently 
    Look at aligning names of types and properties where appropriate