Closed
Description
openedon Oct 3, 2021
See skipped tests in KeysWithConvertersCosmosTest.
With by-convention configuration:
modelBuilder.Entity<IntClassKeyPrincipal>(
b =>
{
b.Property(e => e.Id).HasConversion(IntClassKey.Converter);
});
modelBuilder.Entity<IntClassKeyOptionalDependent>(
b =>
{
b.Property(e => e.Id).HasConversion(IntClassKey.Converter);
b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter);
});
modelBuilder.Entity<IntClassKeyRequiredDependent>(
b =>
{
b.Property(e => e.Id).HasConversion(IntClassKey.Converter);
b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter);
});
Result is:
System.InvalidOperationException
Unable to determine the relationship represented by navigation 'IntClassKeyOptionalDependent.Principal' of type 'IntClassKeyPrincipal'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
at Microsoft.EntityFrameworkCore.Infrastructure.ModelValidator.ValidatePropertyMapping(IModel model, IDiagnosticsLogger`1 logger) in C:\dotnet\efcore\src\EFCore\Infrastructure\ModelValidator.cs:line 265
at Microsoft.EntityFrameworkCore.Infrastructure.ModelValidator.Validate(IModel model, IDiagnosticsLogger`1 logger) in C:\dotnet\efcore\src\EFCore\Infrastructure\ModelValidator.cs:line 61
at Microsoft.EntityFrameworkCore.Cosmos.Infrastructure.Internal.CosmosModelValidator.Validate(IModel model, IDiagnosticsLogger`1 logger) in C:\dotnet\efcore\src\EFCore.Cosmos\Infrastructure\Internal\CosmosModelValidator.cs:line 45
at Microsoft.EntityFrameworkCore.Infrastructure.ModelRuntimeInitializer.Initialize(IModel model, Boolean designTime, IDiagnosticsLogger`1 validationLogger) in C:\dotnet\efcore\src\EFCore\Infrastructure\ModelRuntimeInitializer.cs:line 88
at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, ModelCreationDependencies modelCreationDependencies, Boolean designTime) in C:\dotnet\efcore\src\EFCore\Infrastructure\ModelSource.cs:line 162
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel(Boolean designTime) in C:\dotnet\efcore\src\EFCore\Internal\DbContextServices.cs:line 102
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() in C:\dotnet\efcore\src\EFCore\Internal\DbContextServices.cs:line 129
at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__8_4(IServiceProvider p) in C:\dotnet\efcore\src\EFCore\Infrastructure\EntityFrameworkServicesBuilder.cs:line 303
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, 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.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.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.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.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.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.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 450
at Microsoft.EntityFrameworkCore.DbContext.get_ContextServices() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 432
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 386
at Microsoft.EntityFrameworkCore.DbContext.get_ChangeTracker() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 161
at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Internal.IDbContextPoolable.SnapshotConfiguration() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 873
at Microsoft.EntityFrameworkCore.Internal.DbContextPool`1.Rent() in C:\dotnet\efcore\src\EFCore\Internal\DbContextPool.cs:line 98
at Microsoft.EntityFrameworkCore.Internal.DbContextLease..ctor(IDbContextPool contextPool, Boolean standalone) in C:\dotnet\efcore\src\EFCore\Internal\DbContextLease.cs:line 39
at Microsoft.EntityFrameworkCore.SharedStoreFixtureBase`1.CreateContext() in C:\dotnet\efcore\test\EFCore.Specification.Tests\SharedStoreFixtureBase.cs:line 71
at Microsoft.EntityFrameworkCore.TestUtilities.TestStore.Initialize(Func`1 createContext, Action`1 seed, Action`1 clean) in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStore.cs:line 72
at Microsoft.EntityFrameworkCore.TestUtilities.CosmosTestStore.Initialize(Func`1 createContext, Action`1 seed, Action`1 clean) in C:\dotnet\efcore\test\EFCore.Cosmos.FunctionalTests\TestUtilities\CosmosTestStore.cs:line 161
at Microsoft.EntityFrameworkCore.TestUtilities.TestStore.<>c__DisplayClass13_0.<Initialize>b__0() in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStore.cs:line 41
at Microsoft.EntityFrameworkCore.TestUtilities.TestStoreIndex.CreateShared(String name, Action initializeDatabase) in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStoreIndex.cs:line 28
at Microsoft.EntityFrameworkCore.TestUtilities.TestStore.Initialize(IServiceProvider serviceProvider, Func`1 createContext, Action`1 seed, Action`1 clean) in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStore.cs:line 41
at Microsoft.EntityFrameworkCore.SharedStoreFixtureBase`1.InitializeAsync() in C:\dotnet\efcore\test\EFCore.Specification.Tests\SharedStoreFixtureBase.cs:line 65
at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90
With explicit configuration:
modelBuilder.Entity<IntClassKeyPrincipal>(
b =>
{
b.Property(e => e.Id).HasConversion(IntClassKey.Converter);
b.HasMany(e => e.OptionalDependents).WithOne(e => e.Principal).HasForeignKey(e => e.PrincipalId);
b.HasMany(e => e.RequiredDependents).WithOne(e => e.Principal).HasForeignKey(e => e.PrincipalId);
});
modelBuilder.Entity<IntClassKeyOptionalDependent>(
b =>
{
b.Property(e => e.Id).HasConversion(IntClassKey.Converter);
b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter);
});
modelBuilder.Entity<IntClassKeyRequiredDependent>(
b =>
{
b.Property(e => e.Id).HasConversion(IntClassKey.Converter);
b.Property(e => e.PrincipalId).HasConversion(IntClassKey.Converter);
});
Result is:
System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder`1.HasMany[TRelatedEntity](Expression`1 navigationExpression) in C:\dotnet\efcore\src\EFCore\Metadata\Builders\EntityTypeBuilder`.cs:line 1278
at Microsoft.EntityFrameworkCore.Cosmos.KeysWithConvertersCosmosTest.KeysWithConvertersCosmosFixture.<>c.<OnModelCreating>b__2_3(EntityTypeBuilder`1 b) in C:\dotnet\efcore\test\EFCore.Cosmos.FunctionalTests\KeysWithConvertersCosmosTest.cs:line 249
at Microsoft.EntityFrameworkCore.ModelBuilder.Entity[TEntity](Action`1 buildAction) in C:\dotnet\efcore\src\EFCore\ModelBuilder.cs:line 277
at Microsoft.EntityFrameworkCore.Cosmos.KeysWithConvertersCosmosTest.KeysWithConvertersCosmosFixture.OnModelCreating(ModelBuilder modelBuilder, DbContext context) in C:\dotnet\efcore\test\EFCore.Cosmos.FunctionalTests\KeysWithConvertersCosmosTest.cs:line 245
at Microsoft.EntityFrameworkCore.TestUtilities.TestModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies) in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestModelSource.cs:line 38
at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, ModelCreationDependencies modelCreationDependencies, Boolean designTime) in C:\dotnet\efcore\src\EFCore\Infrastructure\ModelSource.cs:line 159
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel(Boolean designTime) in C:\dotnet\efcore\src\EFCore\Internal\DbContextServices.cs:line 102
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() in C:\dotnet\efcore\src\EFCore\Internal\DbContextServices.cs:line 129
at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__8_4(IServiceProvider p) in C:\dotnet\efcore\src\EFCore\Infrastructure\EntityFrameworkServicesBuilder.cs:line 303
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, 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.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.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.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.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.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.VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 450
at Microsoft.EntityFrameworkCore.DbContext.get_ContextServices() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 432
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 386
at Microsoft.EntityFrameworkCore.DbContext.get_ChangeTracker() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 161
at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Internal.IDbContextPoolable.SnapshotConfiguration() in C:\dotnet\efcore\src\EFCore\DbContext.cs:line 873
at Microsoft.EntityFrameworkCore.Internal.DbContextPool`1.Rent() in C:\dotnet\efcore\src\EFCore\Internal\DbContextPool.cs:line 98
at Microsoft.EntityFrameworkCore.Internal.DbContextLease..ctor(IDbContextPool contextPool, Boolean standalone) in C:\dotnet\efcore\src\EFCore\Internal\DbContextLease.cs:line 39
at Microsoft.EntityFrameworkCore.SharedStoreFixtureBase`1.CreateContext() in C:\dotnet\efcore\test\EFCore.Specification.Tests\SharedStoreFixtureBase.cs:line 71
at Microsoft.EntityFrameworkCore.TestUtilities.TestStore.Initialize(Func`1 createContext, Action`1 seed, Action`1 clean) in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStore.cs:line 72
at Microsoft.EntityFrameworkCore.TestUtilities.CosmosTestStore.Initialize(Func`1 createContext, Action`1 seed, Action`1 clean) in C:\dotnet\efcore\test\EFCore.Cosmos.FunctionalTests\TestUtilities\CosmosTestStore.cs:line 161
at Microsoft.EntityFrameworkCore.TestUtilities.TestStore.<>c__DisplayClass13_0.<Initialize>b__0() in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStore.cs:line 41
at Microsoft.EntityFrameworkCore.TestUtilities.TestStoreIndex.CreateShared(String name, Action initializeDatabase) in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStoreIndex.cs:line 28
at Microsoft.EntityFrameworkCore.TestUtilities.TestStore.Initialize(IServiceProvider serviceProvider, Func`1 createContext, Action`1 seed, Action`1 clean) in C:\dotnet\efcore\test\EFCore.Specification.Tests\TestUtilities\TestStore.cs:line 41
at Microsoft.EntityFrameworkCore.SharedStoreFixtureBase`1.InitializeAsync() in C:\dotnet\efcore\test\EFCore.Specification.Tests\SharedStoreFixtureBase.cs:line 65
at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90
protected class IntClassKey
{
public static ValueConverter<IntClassKey, int> Converter
= new(v => v.Id, v => new IntClassKey(v));
public IntClassKey(int id)
{
Id = id;
}
protected bool Equals(IntClassKey other)
=> other != null && Id == other.Id;
public override bool Equals(object obj)
=> obj == this
|| obj?.GetType() == GetType()
&& Equals((IntClassKey)obj);
public override int GetHashCode()
=> Id;
public int Id { get; set; }
}
protected class IntClassKeyPrincipal : IIntPrincipal
{
public IntClassKey Id { get; set; }
public string Foo { get; set; }
public ICollection<IntClassKeyOptionalDependent> OptionalDependents { get; set; }
public ICollection<IntClassKeyRequiredDependent> RequiredDependents { get; set; }
[NotMapped]
public int BackingId
{
get => Id.Id;
set => Id = new IntClassKey(value);
}
}
protected class IntClassKeyOptionalDependent : IIntOptionalDependent
{
public IntClassKey Id { get; set; }
public IntClassKey PrincipalId { get; set; }
public IntClassKeyPrincipal Principal { get; set; }
[NotMapped]
public int BackingId
{
get => Id.Id;
set => Id = new IntClassKey(value);
}
[NotMapped]
public int? BackingPrincipalId
{
get => PrincipalId?.Id;
set => PrincipalId = value.HasValue ? new IntClassKey(value.Value) : null;
}
}
protected class IntClassKeyRequiredDependent : IIntRequiredDependent
{
public IntClassKey Id { get; set; }
public IntClassKey PrincipalId { get; set; }
public IntClassKeyPrincipal Principal { get; set; }
[NotMapped]
public int BackingId
{
get => Id.Id;
set => Id = new IntClassKey(value);
}
[NotMapped]
public int BackingPrincipalId
{
get => PrincipalId.Id;
set => PrincipalId = new IntClassKey(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment