EF7 aggiunge l'errore di migrazione quando si utilizza l'attributo NotMapped nelle proprietà dell'entità

asp.net-core c# code-first-migrations entity-framework entity-framework-core

Domanda

Non sono in grado di utilizzare l'attributo [NotMapped] sulle proprietà dell'entità perché il comando add migration migration genera un errore di seguito;

Ecco il mio POCO;

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Domain.Entities
{
    public partial class Employer
    {
        public int EmployerId { get; set; }
        public bool? Blacklisted { get; set; }
        [NotMapped]
        public int TestProperty { get; set; }
    }
}

E questo è il messaggio di eccezione che ottengo.

System.ArgumentNullException: Value cannot be null.
Parameter name: navigation
   at Microsoft.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnNavigationAdded(InternalRelationshipBuilder relationshipBuilder, Navigation navigation)
   at Microsoft.Data.Entity.Metadata.Internal.InternalRelationshipBuilder.Relationship(InternalEntityTypeBuilder principalEntityTypeBuilder, InternalEntityTypeBuilder dependentEntityTypeBuilder, String navigationToPrincipalName, String navigationToDependentName, IReadOnlyList`1 dependentProperties, IReadOnlyList`1 principalProperties, Nullable`1 isUnique, Nullable`1 isRequired, Nullable`1 deleteBehavior, Boolean strictPrincipal, Boolean oldRelationshipInverted, String oldNavigationToPrincipalName, String oldNavigationToDependentName, ConfigurationSource configurationSource, Boolean runConventions)
   at Microsoft.Data.Entity.Metadata.Internal.InternalRelationshipBuilder.ReplaceForeignKey(InternalEntityTypeBuilder principalEntityTypeBuilder, InternalEntityTypeBuilder dependentEntityTypeBuilder, String navigationToPrincipalName, String navigationToDependentName, IReadOnlyList`1 dependentProperties, IReadOnlyList`1 principalProperties, Nullable`1 isUnique, Nullable`1 isRequired, Nullable`1 deleteBehavior, Boolean strictPrincipal, Boolean oldRelationshipInverted, ConfigurationSource configurationSource, Boolean runConventions)
   at Microsoft.Data.Entity.Metadata.Internal.InternalRelationshipBuilder.ReplaceForeignKey(ConfigurationSource configurationSource, InternalEntityTypeBuilder principalEntityTypeBuilder, InternalEntityTypeBuilder dependentEntityTypeBuilder, String navigationToPrincipalName, String navigationToDependentName, IReadOnlyList`1 dependentProperties, IReadOnlyList`1 principalProperties, Nullable`1 isUnique, Nullable`1 isRequired, Nullable`1 deleteBehavior, Boolean strictPrincipal, Boolean oldRelationshipInverted, Boolean runConventions)
   at Microsoft.Data.Entity.Metadata.Internal.InternalRelationshipBuilder.Navigations(String navigationToPrincipalName, String navigationToDependentName, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.Navigations(InternalRelationshipBuilder relationship, String navigationToPrincipalName, String navigationToDependentName, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.Relationship(InternalEntityTypeBuilder targetEntityTypeBuilder, PropertyInfo navigationToTarget, PropertyInfo inverseNavigation, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.FindRelationshipCandidates(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, String ignoredMemberName)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeMemberIgnored(InternalEntityTypeBuilder entityTypeBuilder, String ignoredMemberName)
   at Microsoft.Data.Entity.Metadata.Internal.InternalEntityTypeBuilder.Ignore(String memberName, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NotMappedMemberAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.InversePropertyAttributeConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder, PropertyInfo navigationPropertyInfo, InversePropertyAttribute attribute)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.NavigationAttributeEntityTypeConvention`1.Apply(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)
   at Microsoft.Data.Entity.Metadata.Internal.MetadataDictionary`2.GetOrAdd(Func`1 getKey, Func`1 createKey, Func`2 createValue, Func`2 onNewKeyAdded, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource)
   at Microsoft.Data.Entity.ModelBuilder.Entity(Type type)
   at Microsoft.Data.Entity.Infrastructure.ModelSource.FindSets(ModelBuilder modelBuilder, DbContext context)
   at Microsoft.Data.Entity.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
   at Microsoft.Data.Entity.Infrastructure.ModelSource.<>c__DisplayClass8_0.<GetModel>b__0(Type k)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Data.Entity.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
   at Microsoft.Data.Entity.Internal.DbContextServices.CreateModel()
   at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()
   at Microsoft.Data.Entity.Internal.DbContextServices.get_Model()
   at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c.<AddEntityFramework>b__0_5(IServiceProvider p)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.FactoryService.Invoke(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass12_0.<RealizeService>b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetService[T](IServiceProvider provider)
   at Microsoft.Data.Entity.Design.Internal.DesignTimeServicesBuilder.<>c__DisplayClass7_0.<ConfigureContextServices>b__8(IServiceProvider _)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.FactoryService.Invoke(ServiceProvider 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.ServiceProvider.<>c__DisplayClass12_0.<RealizeService>b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[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.<AddMigration>b__0()
   at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)
Value cannot be null.
Parameter name: navigation

E queste sono le mie dipendenze da pacchetto;

"dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.Core": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer.Design": "7.0.0-rc1-final",
    "EntityFramework.Relational": "7.0.0-rc1-final",
    "EntityFramework.Relational.Design": "7.0.0-rc1-final"
  },

Qualche idea sul motivo per cui non sono in grado di utilizzare l'attributo [NotMapped] in qualsiasi punto delle mie proprietà dell'entità?

Aggiornamento: come suggerito da Don, l'uso di Fluent-api invece delle annotazioni funziona ma voglio comunque utilizzare le annotazioni. Il mio obiettivo è aggiungere l'attributo [NotMapped] all'entità base in modo che non debba aggiungerlo alle entità child.

Questo è quello che sto cercando di realizzare;

Associazione della proprietà ID di base alla chiave primaria delle entità senza aggiungere la colonna Id al database.

public class EntityBase
{
   [NotMapped]
   public virtual int Id{ get; set; }
}

//Auto generated POCO
public partial class MyEntity
{
   //The primary key
   public virtual int MyEntityId{ get; set; }
}

//Partial class that I modify the auto generated Poco
public partial class MyEntity : EntityBase
{
    public override int Id 
    {
     get { return MyEntityId; } 
     set { MyEntityId = value; }
     }
}

Risposta accettata

Prova a utilizzare Fluent-API

modelBuilder.Entity<Employer>().Ignore(e => e.TestProperty);


Autorizzato sotto: CC-BY-SA with attribution
Non affiliato con Stack Overflow
È legale questo KB? Sì, impara il perché
Autorizzato sotto: CC-BY-SA with attribution
Non affiliato con Stack Overflow
È legale questo KB? Sì, impara il perché