-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement : Reverse Engineer from an EDMX file? #551
Comments
I think it could be quite difficult, as the current reverse engineering is based on a database model, not a conceptual edmx model... But interesting thought. Your task would be to create a class that can create a DatabaseModel from an edmx, have a look at the code that does this from a .dacpac. (that has been serialized into a TSqlModel) |
Maybe you could use this? https://archive.codeplex.com/?p=linqtoedmx |
All right, let me see what I can do. |
Perfect, ping me with any design questions. |
Found this - LINQ to EDMX looks vry old: https://github.com/robertmclaws/EDMXParsingSample/blob/master/src/EdmxParsingSample.Data/EdmxLoader.cs |
@ErikEJ Just to let you know that I've started the porting process of the old LinqToEdmx to .NET Standard 2.1. |
Wauw! |
If you think it adds value, sure, it will mainly be an implementation of DatabaseModelFactory. i suggest you start with the code generation parts, and verify by running the console app. |
I also have to say that I'm using Visual Studio 2019 for Mac. The EFCorePowerTools project is unrecognised in this environment. I'm open to some alternative build/debug guidelines. Thanks in advance. |
This is a Visual Studio project, but you could maybe run the code generation parts on Mac... The end result could be a package similar to the Nuget package for .dacpac support. But being able to open the solution file is most likely a must, are you able to do that? If not, we could take a Teams call and I can walk you through the moving parts? |
The solution file opens fine. VS complains that this project is an unknown solution item type. |
Yes, that is expected for the Vsix project, but you should be able to open the .net Core projects, and they are the important ones... We are talking in the blind here, is my impression |
All the other projects are loading correctly ;) |
Ok, then you are good to proceed! |
Yep ! Correct me if I'm wrong but I think I should create two new projects:
To follow what has been done for Dacpac? I'll let you validate the namespaces and project names though. |
Yes, that would be the final outcome. |
Hmmm... What provider will this target? The DatabaseModel is provider specific? |
No, it will be provider agnostic. |
Curious how that will pan out in real life... And runtime it will execute against some database, I presume?? |
I think it will depend on what is missing in the Edmx file. For instance, Index informations are not there, but we may optionally connect to the database to get them. Primary and foreign keys are there of course. For me the main idea is to never create the database from the scaffolding data, just be able to work with a generated context of an existing database from which one had generated (and tweaked) an edmx in the past. |
Thanks for the explanation! Makes sense to me... |
Hi @ErikEJ |
@omatrot I assume it could be this one: https://github.com/dotnet/efcore/blob/main/src/EFCore.Relational/Metadata/IRelationalModel.cs |
I would provide both then, if that makes sense to the tooling. That makes sense to me anyway. |
Tooling does not use the IRelationalModel, but feel free to expose it, we should consider publishing a NuGet package. |
I'm not done yet ;) |
Correct, look at the .dacpac Databasefactory |
Hi @ErikEJ |
Wauw - exciting! |
I may have spoken too fast... |
I sincerely doubt there will be many consumers of the IRelationalModel - but do a PR so we can have a fact based discussion? |
PR opened. |
The PR is now merged, and you can test it by picking an EDMX file via the Select Data Source dialog. Thanks for your patience! |
Could you describe this selling point of this feature in a sentence? I plan to tweet that it is now available in the latest daily build. |
I’ll do that.
I may be wrong but I suspect that you now allow to select an edmx, then process as usual to select what to reverse engineer ?
The edmx file already contains that information in the so called conceptual model.
We could bypass this step, if I provide you what you need.
|
Why don't you try it out? |
I've tried it out ;) Selling point: |
I'm wondering if we could in the future reverse engineer from an existing edmx file ?
Would it be difficult to port the code that existed in the initial EF Power tools ?
I may have some time to dedicate to this task in the near future.
The text was updated successfully, but these errors were encountered: