我正嘗試使用JSON列創建遷移。下面是我的嘗試:Npgsql/EF 6 - json列
[Column(TypeName = "Jsonb")]
public string Data { get; set; }
[Column(TypeName = "Json")]
public string Data { get; set; }
modelBuilder.Entity<Member>().Property(p => p.Data).HasColumnType("Json");
modelBuilder.Entity<Member>().Property(p => p.Data).HasColumnType("Jsonb");
沒有什麼工作可言,這裏的例外:
System.InvalidOperationException:序列不包含任何匹配的元素 在System.Linq.Enumerable.Single [TSource](IEnumerable的
1 source, Func
2謂詞) 在System.Data.Entity.Utilities.DbProviderManifestExtensions.GetStoreTypeFromName(DbProviderManifest providerManifest,字符串名稱) 在System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.ConfigureColumn(EdmProperty柱,耳鼻喉ityType表,DbProviderManifest providerManifest) 在System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(EdmProperty列,的EntityType表,DbProviderManifest providerManifest,布爾有的allowOverride,布爾fillFromExistingConfiguration) 在System.Data.Entity.ModelConfiguration .Configuration.Properties.Primitive.PrimitivePropertyConfiguration。 <> c__DisplayClass4.b__3(數組2 pm) at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable
1 TS,動作1 action) at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(IEnumerable
1個propertyMappings,DbProviderManifest providerManifest,布爾有的allowOverride,布爾fillFromExistingConfiguration) 在System.Data.Entity.ModelConfiguration.Configuration.Types.StructuralTypeConfiguration.ConfigurePropertyMappings(IList的1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride) at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigurePropertyMappings(DbDatabaseMapping databaseMapping, EntityType entityType, DbProviderManifest providerManifest, Boolean allowOverride) at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EntityType entityType, DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest) at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntityTypes(DbDatabaseMapping databaseMapping, ICollection
1個entitySets,DbProviderManifest providerManifest ) 在System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.Configure(DbDatabaseMapping databaseMapping,DbProviderManifest providerManifest) 在System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest,DbProviderInfo providerInfo) 在System.Data.Entity.DbModelBuilder .Build(DbConnection providerConnection) at System.Data.Entity.Internal.LazyInternalC ontext.CreateModel(LazyInternalContext internalContext) 在System.Data.Entity.Internal.RetryLazy2.GetValue(TInput input) at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet
1.Initialize() 在System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() at System.Data.Entity.Internal.Linq.InternalSet
1.get_Local() 在System.Data.Entity的.dbSet`1.get_Local() at System.Data.Entity.DbModelBuilderExtensions.RegisterUserAccountChildTablesForDelete [TKey,TAccount,TUserClaim,TLinkedAccount,TLinkedAccountClaim,TPasswordResetSecret,TTwoFactorAuthToken,TUserCertificate](DbContext ctx)in c:\ ballen \ github \ brockallen \ BrockAllen.MembershipReboot的\ src \ BrockAllen.MembershipReboot.Ef \ DbModelBuilderExtensions.cs:行26
這裏是我的配置:
<package id="EntityFramework" version="6.1.1" targetFramework="net452" />
<package id="EntityFramework6.Npgsql" version="3.1.1" targetFramework="net452" />
<package id="Npgsql" version="3.1.6" targetFramework="net452" />