1

I am using EdmGen.exe to automatically generate files:

  • Database.cs
  • Views.cs
  • Concept.csdl
  • Storage.ssdl
  • Mapping.msl

How can I generate an EDMX file from all that, so I can include it into my Visual Studio project?

I'm trying to automate EDMX update in such a way that would not require use of Visual Studio IDE, i.e. completely from command line.

Reasons

My development team needs to start using a huge Oracle database, which was designed long ago, and undergoes small, non-frequent changes. ODP Entity Framework from Oracle seems to be a very good platform for the job, but their Visual Studio Integration Tools comes as a disaster, which we are trying to avoid like a plague. I was asked to script automatic EF model generation completely from command line. Generating a new EDMX from CSDL+SSDL+MSL files is where I got stuck.

vitaly-t
  • 24,279
  • 15
  • 116
  • 138

1 Answers1

1

What you want is far out of left field for EF. I'm pretty sure you're going to have to write some custom tooling as the EDMX generation isn't something I see Visual Studio calling into making me think it's part of the IDE itself.

A couple resources I found on this:

Looking at an EDMX I have locally, it's basically just a logical mashup of those files you already have generated so you should be able to figure out and write a generator without too much hassle. Granted, it'll be tedious as hell.

Bottom line, I just don't think there's a tool to do this for you given the typical EF development strategies of code-first or database-first approaches. The prescribed approached here would be code-first but I totally get why you don't want to recreate them.

That said, unless you absolutely need an EDMX for some reason (visualization, or something), I would actually just template out your models and do a pseudo "code first" approach and not even worry about the EDMX tool chain.

Best of luck.

Bigsby
  • 952
  • 6
  • 20
  • Almost hard to believe that Entity Framework cannot be used without UI. I think that perhaps there is a way to generate all necessary model files to be included without EDMX at all? Like, with parameter /mode:FromSsdlGeneration – vitaly-t Jul 30 '15 at 21:34
  • You can absolutely "use Entity Framework" without a UI. It's called code-first. You don't want to do that. You can always try plugging the files you already have into the standard EF connection string. The only thing the EDMX gets you beyond the designer is a concrete `DbContext` version that wraps up your entities into `EntitySet<>` objects. – Bigsby Jul 30 '15 at 22:53
  • I may have asked the wrong question about just getting an EDMX, but it is very doable in .NET. I found out that the rest of steps are simply done with help of TextTransform.exe utility that comes with .NET for T4 template transformation. One just needs the right T4 templates. – vitaly-t Jul 31 '15 at 00:16
  • Accepting the answer 5 years, later, unable to remember what this was all about :) – vitaly-t Oct 23 '20 at 15:14