Closed MagicAndre1981 closed 11 months ago
I'll add this as an enhancement request, but it's a pretty big deal. You can already import a compiled assembly that contains a DbContext ... just drag/drop the assembly onto the design surface, and it'll consume the metadata to create as much of the model as it can.
You can already import a compiled assembly that contains a DbContext ... just drag/drop the assembly onto the design surface, and it'll consume the metadata to create as much of the model as it can.
I tried this, but only get a FileLoadException with return code 2 in EF Designer output window inside VS2019.
With capturing exceptions via ETW I also see that a file called CoreDll.dll was not found (happens in EF6Parser tool).
CoreDll.dll was not found
Well, that's unusual. That's not being referenced anywhere in the import utilities and, from what I see, should only be available on the now-extinct Windows Mobile platform. I'm at a loss on that one.
I'm at a loss on that one.
I'm also confused
the parser targets .net core 3.1, maybe targeting as 5.0 and removing the old references helps. Also try to use the Microsoft.Extensions.Logging, here there is also log4net provider available, because I think this is triggered by log4net because the callstack in WPA shows that the exception happens in main:
It looks like this strange message comes from log4net:
still doesn't work for me with the latest change.
I still get the FileLoadException with Result 2.
I also used a EFCore 5 console test application (Firebird 3, sample employee database included in FB), when I drag the the dll/exe but here I get this error message for EFCore2/3 Parser
Warning: 2021-05-31 08:26:19,107 [1] ERROR EFCore3Parser.Program [(null)] - Caught TypeLoadException - Could not load type 'Microsoft.EntityFrameworkCore.IndexAttribute' from assembly 'Microsoft.EntityFrameworkCore.Abstractions, Version=3.1.10.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Warning: 2021-05-31 08:26:19,107 [1] ERROR EFCore3Parser.Program [(null)] - Exiting with return code 4
and no entries in diagram, which is confusing because it looks like the EFCore5 parser worked, I see no error output for EFCore5Parser.exe.
Can you please verify that this problem still exists?
yes, still the same "Could not load assembly" error with Result 2 in VS2022 with last 4.2 of your designer
@MagicAndre1981 - I've removed log4net from the parsers in v4.2.2.4, the build being here. Would you mind giving it a try?
ok, I still get an error but now I see an ArgumentException "Empty path name is not legal" and later the FileLoadException.
I gave it up on this and found a new tool that converts an EDMX to a JSON which includes the mappings and generates the Model classes when invoking Scaffold-DbContext from inside of VS.
I'll leave this open, maybe it can be fixed later.
I've found that drag/drop works best when you drag from a directory that has a "published" version of your assembly rather than simply a compiled version (that is, assuming .NET Core). All my testing is working 100% when I do that.
And there may be some changes in the import-from-database-structure side. Too early to announce, but some things are in the works.
Closing due to lack of activity.
I tried that all. I use the other tool now which is working. Do the same and parse the EDMX to generate the model.
I have a question. I saw that you don't want to support reverse engineer of existing database.
But what about importing already created EDMX files and migrate it to efmodel file? This could help to migrate old EF6 applications to EFCore (which is what I want to do and evaluate tools that I can find here on github or VS marketplace).