Please I updated my .NET 5 to .NET 6 and I have this errors on adding migration:
System.MissingMethodException: Method not found: 'System.Type Microsoft.EntityFrameworkCore.Metadata.ITypeBase.get_ClrType()'.
at Abp.EntityFrameworkCore.AbpDbContext.OnModelCreating(ModelBuilder modelBuilder)
at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext`3.OnModelCreating(ModelBuilder modelBuilder)
at Abp.Zero.EntityFrameworkCore.AbpZeroDbContext`4.OnModelCreating(ModelBuilder modelBuilder)
at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context)
at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies)
at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, ModelCreationDependencies modelCreationDependencies, Boolean designTime)
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel(Boolean designTime)
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__8_4(IServiceProvider p)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCacMicrosoft.EntityFrameworkCore.Metadata.ITypeBase.get_ClrType()'.
I have checked all my Microsoft.EntityFrameworkCore packages and they are of the same version. Is pointing this version of my code,
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<BinaryObject>(b =>
{
b.HasIndex(e => new { e.TenantId });
});
modelBuilder.Entity<ChatMessage>(b =>
{
b.HasIndex(e => new { e.TenantId, e.UserId, e.ReadState });
b.HasIndex(e => new { e.TenantId, e.TargetUserId, e.ReadState });
b.HasIndex(e => new { e.TargetTenantId, e.TargetUserId, e.ReadState });
b.HasIndex(e => new { e.TargetTenantId, e.UserId, e.ReadState });
});
modelBuilder.Entity<Friendship>(b =>
{
b.HasIndex(e => new { e.TenantId, e.UserId });
b.HasIndex(e => new { e.TenantId, e.FriendUserId });
b.HasIndex(e => new { e.FriendTenantId, e.UserId });
b.HasIndex(e => new { e.FriendTenantId, e.FriendUserId });
});
modelBuilder.Entity<Tenant>(b =>
{
b.HasIndex(e => new { e.SubscriptionEndDateUtc });
b.HasIndex(e => new { e.CreationTime });
});
modelBuilder.Entity<SubscriptionPayment>(b =>
{
b.HasIndex(e => new { e.Status, e.CreationTime });
b.HasIndex(e => new { PaymentId = e.ExternalPaymentId, e.Gateway });
});
modelBuilder.Entity<SubscriptionPaymentExtensionData>(b =>
{
b.HasQueryFilter(m => !m.IsDeleted)
.HasIndex(e => new { e.SubscriptionPaymentId, e.Key, e.IsDeleted })
.IsUnique();
});
modelBuilder.Entity<UserDelegation>(b =>
{
b.HasIndex(e => new { e.TenantId, e.SourceUserId });
b.HasIndex(e => new { e.TenantId, e.TargetUserId });
});
modelBuilder.ConfigurePersistedGrantEntity();
}
Is there thing I can implement to solve this issue.
This error occurs when you have different versions of Entity Framework Core and .NET Core in your project, please be sure to install the version of Entity Framework compatible with your .NET Core version.
For .NET 5.0 the packages are:
Microsoft.EntityFrameworkCore.Design [5.0.10]
Microsoft.EntityFrameworkCore.SqlServer [5.0.10]
Microsoft.EntityFrameworkCore.Tools [5.0.10]
For .NET 6.0 you can install:
Microsoft.EntityFrameworkCore.Design [6.0.10]
Microsoft.EntityFrameworkCore.SqlServer [6.0.10]
Microsoft.EntityFrameworkCore.Tools [6.0.10]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With