Is it possible to generate an Edmx file by creating the collection开发者_高级运维s (schema, conceptual, mappings) and mappings in code and building it up in C#? Note - I've used EdmGen and EdmGen2 which read from a database to create the Edmx. I want to be able to pass the specific items into the metadata without pointing at a database.
Any ideas appreciated. thanks.
Why not use code first? This is essentially what code first does; it inspects the POCO CLR types you have in your project and creates the corresponding conceptual/storage/mappings by convention. You can also configure those conventions through a fluent code API.
When you spin up a code first DbContext, you can also get to the resulting XML-based EDMX (if you really need it) from within it through a WriteEdmx() method.
If you don't want Code First to generate a database automatically, you can turn off that 'initializer'.
You can write a simple dummy db context and use this VS extension to get the EDMX generated http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d
精彩评论