appany / AppAny.Quartz.EntityFrameworkCore.Migrations

EntityFrameworkCore PostgreSQL migrations for Quartz.NET
MIT License
70 stars 18 forks source link

Update packages to EF Core 7 #59

Closed sfmskywalker closed 8 months ago

sfmskywalker commented 10 months ago

First off, thank you for this wonderful project! Very clever to use EF Core to generate migrations 💡

I would like to use this with SQLite and EF Core 7, but I am getting a FileNotFoundException:

Could not load file or assembly 'System.Data.SQLite, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

I'm pretty sure this might have something to do with the fact that I am using EF Core 7, while AppAny.Quartz.EntityFrameworkCore.Migrations.SQLite uses Microsoft.EntityFrameworkCore.Sqlite version 6.0.1.

Would you be open to accepting a PR that updates the EF Core package references to 7.0.13?

sfmskywalker commented 10 months ago

I'm pretty sure this might have something to do with the fact that I am using EF Core 7

I just tried this, but I was wrong - the same exception occurs, so it must be something else. I'll keep looking.

sfmskywalker commented 10 months ago

Turns out I had to use UseMicrosoftSQLite instead of UseSqlite - I discovered this while looking at one of the tests. Still, I'd be happy to submit a PR to update the packages if you want 😄

sfmskywalker commented 10 months ago

Aha, in order to generate SQL Server migrations using EF Core 7.x tooling, an upgrade is required. Without it, one will get the following exception:

System.MissingMethodException: Method not found: 'Void CoreTypeMappingParameters..ctor(System.Type, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, System.Func`3<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator>)'.
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerFloatTypeMapping..ctor(String storeType, Nullable`1 dbType, StoreTypePostfix storeTypePostfix)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerTypeMappingSource..ctor(TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)

When I use my updated fork, it works without issue.

sergeyshaykhullin commented 8 months ago

https://www.nuget.org/packages/AppAny.Quartz.EntityFrameworkCore.Migrations.PostgreSQL/0.5.0