0

Does the entity framework provides an API for .net (c#) to generate models from an existing database? I don't want to use EdmGen.exe, because a direct integration would be nice.

Maybe even the code which is used by the EdmGen.exe provides some information, because they also have to use some API functionality.

This is needed, because i want to compile the models dynamicaly with roslyn at runtime, which is currently working pretty well with some demo models.

Thank you.

BendEg
  • 20,098
  • 17
  • 57
  • 131
  • Why not use the Database first approach? more info [here](https://msdn.microsoft.com/en-us/data/jj206878.aspx?f=255&MSPPError=-2147217396) – Zippy Jul 08 '15 at 12:59
  • Because i compile the models with Roslyn dynamically and make it available in ironPython for customizing :) – BendEg Jul 08 '15 at 13:00
  • Then give more info about your problem in the question, please. – Zippy Jul 08 '15 at 13:01
  • 1
    The source code for edmgen2 is here, it will give you some insights on how to generate a edm from your own code: https://github.com/cincuranet/EdmGen2 – ErikEJ Jul 08 '15 at 15:08
  • 1
    In addition to EricEJ answer you can have a look also at this project EntityFramework Reverse POCO Generator https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838 but I think it does not use EF API (it generate the code directly starting from SQL Server but I'm not sure about it because usually I use edmgen). – bubi Jul 08 '15 at 15:20
  • Ok, if used `edmgen2` for generating some models. But why does i get an `ObjectContext` and no `DbContext`. Further more i get `ObjectSet` instead of the very nice `DbSet`. Event the Models aren't POCO. Thank you, maybe some one could explain why :) – BendEg Jul 09 '15 at 08:52

0 Answers0