-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot have keys other than those declared on the root type #5201
Comments
Found the cause of the issue, |
Exception message has been updated after RC1 see #3727 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having problems mapping types in an inheritance gain.
My Models:
My context:
My Mapper
Exception in command line
C:\Code\BookerTools\Source\Development\Version_1\Source\BookerTools.Database.EF>
dnx ef migrations add BT-0001 -c "ApplicationContext" -p "BookerTools.Database.E
F"
System.InvalidOperationException: The derived type 'BookerTools.Framework.Models
.BinaryImage' cannot have keys other than those declared on the root type.
at Microsoft.Data.Entity.Metadata.Internal.EntityType.AddKey(IReadOnlyList
1 properties) at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary
2.GetOrAdd(Func1 getKey, Func
1 createKey, Func2 createValue, Func
2 onNewKeyAdded, ConfigurationSource configurationSource)
at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.HasKey(I
ReadOnlyList
1 properties, ConfigurationSource configurationSource) at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.PrimaryK ey(IReadOnlyList
1 properties, ConfigurationSource configurationSource)at Microsoft.Data.Entity.Metadata.Builders.EntityTypeBuilder
1.HasKey(Express ion
1 keyExpression)at BookerTools.Database.EF.Mappers.FrameworkModelsMapper.MapEntity[T](EntityT
ypeBuilder
1 builder) at BookerTools.Database.EF.Mappers.FrameworkModelsMapper.<>c.<MapBinaryImage> b__5_0(EntityTypeBuilder
1 builder)at Microsoft.Data.Entity.ModelBuilder.Entity[TEntity](Action
1 buildAction) at BookerTools.Database.EF.Mappers.FrameworkModelsMapper.Map(ModelBuilder bui lder) at BookerTools.Database.EF.Context.ApplicationContext.OnModelCreating(ModelBu ilder modelBuilder) at Microsoft.Data.Entity.Infrastructure.ModelSource.CreateModel(DbContext con text, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func
2 valueFactory) at Microsoft.Data.Entity.Internal.DbContextServices.CreateModel() at Microsoft.Data.Entity.Internal.LazyRef
1.get_Value()at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.In
voke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetServ
ice[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite
.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite
.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite
.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequ
iredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequ
iredService[T](IServiceProvider provider)
at Microsoft.Data.Entity.Design.MigrationsOperations.AddMigration(String name
, String outputDir, String contextType)
at Microsoft.Data.Entity.Commands.Program.Executor.<>c__DisplayClass6_0.b__0()
at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)
The derived type 'BookerTools.Framework.Models.BinaryImage' cannot have keys oth
er than those declared on the root type.
Is there something that I'm missing?
The text was updated successfully, but these errors were encountered: