- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法在实体属性上使用 [NotMapped] 属性,因为迁移添加命令在下面抛出错误;
这是我的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; }
}
}
这是我收到的异常消息。
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
这些是我的包依赖项;
"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"
},
知道为什么我无法在我的实体属性中的任何地方使用 [NotMapped] 属性吗?
更新:正如 Don 所建议的,使用 Fluent-api 而不是注释是可行的,但我仍然想使用注释。我的目标是将 [NotMapped] 属性添加到基础实体,这样我就不必将它添加到子实体。
这就是我想要完成的;
将基本 Id 属性映射到实体的主键,而不将 Id 列添加到数据库。
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; }
}
}
最佳答案
尝试使用Fluent-API
modelBuilder.Entity<Employer>().Ignore(e => e.TestProperty);
关于c# - EF7 在实体属性中使用 NotMapped 属性时添加迁移错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33928957/
我最近开始从事一个 Sails 项目。它目前在迁移表下具有以下格式的迁移。 20160826122004-create_users_table.js 'use strict'; module.expo
当我尝试迁移时 doctrine:migrations:migrate ,我收到此异常:“元数据存储不是最新的,请运行 sync-metadata-storage 命令来解决此问题。”。这仅在尝试在生
我在 ec2 linux 7 上有一个 MarkLogic 服务器。我想将它迁移到 linux 6。我将 ebs 移动到新的 linux 6 并将其安装在 /var/opt/MarkLogic . 我
我对 OpenID 很好奇。虽然我同意统一凭证的想法很棒,但我有一些保留意见。什么是防止 OpenID 提供商发疯并持有他们拥有的 OpenID 帐户直到您支付 n 美元?如果我决定不喜欢这个提供商,
使用 SQL 很容易做到这一点,但我需要编写一个我不熟悉的 Knex 迁移脚本。以下代码在 order 表中行的末尾添加了 order_id 列。我想在 id 之后添加 order_id。我该怎么做?
使用 SQL 很容易做到这一点,但我需要编写一个我不熟悉的 Knex 迁移脚本。以下代码在 order 表中行的末尾添加了 order_id 列。我想在 id 之后添加 order_id。我该怎么做?
我想通过在 Yii2 中的迁移添加一个新列,使用以下代码: public function up() { $this->addColumn('news', 'priority', $this-
我正在尝试在 SQLDelight 的表中添加更多列。我做了一个迁移文件 1.sqm .在迁移文件中,它给出了找不到表的错误。 我的 build.gradle.kts: sqldelight {
我有一个与 Flyway DB 迁移相关的问题。通常如何管理处理相同 DB 模式的多个项目(微服务)。每个项目中的 Flyway 迁移脚本如果被其他项目修改,则不允许启动。他们是否有任何文档或最佳实践
我是 Laravel 的新手。我做了一份待办事项申请作为一项学校作业。我们必须使用迁移来创建我们的数据库。 我使用迁移创建了 2 个表。我的问题是:如果你第一次在你的电脑上运行这个项目,有没有办法自动
我正在尝试在 Laravel 中创建外键,但是当我使用 artisan 迁移表时,出现以下错误: [Illuminate\Database\QueryException] SQLSTATE[HY000
我从 Django 1.7 升级到 Django 1.9。我有多次迁移。升级后我无法再创建新的数据库。 问题是“django manage.py migrate”运行检查。检查导入应用程序 URL。这
我在创建数据迁移方面遇到了困难。我的应用程序使用两个数据库。我在 settings.py 中配置了数据库,并创建了一个像 Django docs 中一样的路由器. # settings.py DB_H
我有一个像这样的sql结构: CREATE TABLE resources ( id SERIAL PRIMARY KEY, title TEXT NOT NULL, created_at
我正在尝试使用模式构建器向表添加枚举选项(不丢失当前数据集)。 我真正能够找到的关于列更改的唯一信息是 http://www.flipflops.org/2013/05/25/modify-an-ex
我尝试转移到一些 CMake 程序中,并且有一个从 xml 生成头文件的函数。 生成文件.am adaptor_glue.hpp: dbus_introspect.xml $(DBUSXX_X
我想将文件移至我的 iOS 应用程序的 CoreData 存储 ../Library/Application Support/MyApp/ 至 ../Documents/Stores/ 我可以使用 N
有没有人对数据迁移进出 NetSuite 有丰富的经验?我必须将 DB2 表导出到 MySQL,处理数据,然后导出到一个 CSV 文件中。然后获取帐户的 CSV 文件并再次操作数据以使帐户从我们的旧系
我正在尝试在 Django 上建立一个博客。我已经走到了创建模型的地步。他们在这里: from django.db import models import uuid class Users(mode
我最近使用 bluehost 上的 AutoSSL 工具将网站迁移到 HTTPS。我在内容中看到一些失真,例如缺少背景颜色、表格位移、缺少_logos 等。 有谁知道 HTTPS 迁移效果如何影响样式
我是一名优秀的程序员,十分优秀!