Closed EngrKhizarIqbal closed 4 years ago
Hello @EngrKhizarIqbal ,
All you have to do is to create for example a console application (.NET Framework), add entities and generate the migration from it as you would normally do without .NET Core
So you will be able to use this project to generate and apply your migration. It's probably possible to add it to your main project but some additional steps might be required if you don't use the same exact namespace.
Let me know if that answers your question.
Best Regards,
Jonathan
It's probably possible to add it to your main project but some additional steps might be required if you don't use the same exact namespace.
That's what we are facing the problem. We have successfully created migrations in a class project with EntityFramework. We are using FluentAPI to configure our entities but we have to create two configurations for each entity. One is to use with Z and others with EntityFramework as when using Z, modelBuilder.Configurations.Add();
expects configuration which inherits from your Z, not from EntityFramework and same goes for the opposite.
If you want, I can share the sample code I've worked on.
Sure @EngrKhizarIqbal ,
Please share it here info@zzzprojects.com
hello @EngrKhizarIqbal,
Since our last conversation, we haven't heard from you.
Don't hesitate to share your project via our email info@zzzprojects.com
Looking forward to hearing from you,
Jon
Hi, I was out of town. I'll share the project tomorrow.
Thanks.
Awesome!
thank you for the updates!
Jon
Hi @JonathanMagnan, Here is the example code. https://github.com/EngrKhizarIqbal/ef-classic-migrations
Hello @EngrKhizarIqbal ,
Just to let you know that we started to look at it.
At first sight, we find it strange that you didn't use the migration directly from EF Classic.
However, when we tried it, we got the following exception:
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'Z.EntityFramework.Classic, Version=7.0.0.0, Culture=neutral, PublicKeyToken=afc61983f100d280' or one of its dependencies. Strong name signature could not be verified.
The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)"
which seems to be our fault but we are not sure why yet.
We are currently looking at it.
Hello @EngrKhizarIqbal ,
A new version has been released (v7.1.20) fixing an issue with the signed key.
However, when I re-read your issue, I'm not sure that changing the dependencies in your EFMigrations
project is what you are looking for.
Is the EntityFramework dll is really needed or it was only needed for the EFMigrations
project?
If that was only required for the EFMigrations
projects then I recommend you remove the dependencies and go all the way with EF Classic. The command line should now work correctly with our library
Hi @JonathanMagnan Thanks for the update. Yes, now Migrations are working with the EntityFramework-Classic.
EFMigrations
projects are to create migrations as was recommended by EntityFramework-Classic and now this is removed from limitations. I've updated the project, tested it and pushed the updated code on the repo here.
Thanks for your help.
Awesome,
So everything is correct? Just to be sure ;)
Yes. Everything is working as expected.
Thanks.
Awesome @EngrKhizarIqbal,
We will close this issue since we were able to solve it! Feel free to contact us for questions, issues or feedback.
Best Regards,
Jon
As per your docs:
Should anyone please guide me to a link or example explaining how we can achieve this?
Thanks.