mysql数据库number_MySQLNumberTypeMapping’不支持值转换

我添加了一些模型,用于连接到SQL数据库,现在移植到

MySQL.我运行时收到此错误:dotnet ef update –context {context}

Blockquote

System.NotImplementedException: The ‘MySQLNumberTypeMapping’ does not support value conversions. Support for value conversions typically requires changes in the database provider.

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapping.Clone(ValueConverter converter)

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.b__7_0(ValueTuple3 k)

at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMappingWithConversion(RelationalTypeMappingInfo& mappingInfo, IReadOnlyList1 principals)

at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(MemberInfo member)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyDiscoveryConvention.IsCandidatePrimitiveProperty(PropertyInfo propertyInfo)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.PropertyDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ImmediateConventionScope.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.RunVisitor.VisitOnEntityTypeAdded(OnEntityTypeAddedNode node)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.VisitConventionScope(ConventionScope node)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionVisitor.VisitConventionScope(ConventionScope node)

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.ConventionBatch.Run()

at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.DiscoverRelationships(InternalEntityTypeBuilder entityTypeBuilder) …

‘MySQLNumberTypeMapping’不支持值转换.对值转换的支持通常需要更改数据库提供程序.

以下是我希望创建的表格:(我删除了对DataType(*)或枚举的任何引用,但我可能是MySQL的问题.

[Key]

public int ID { get; set; }

[StringLength(50)]

public string Name { get; set; }

public int? PropertyID { get; set; }

public Property Property { get; set; }

//public SelectList Animals { get; set; }

//public string AnimalTypes { get; set; }

[Display(Name="Spesie")]

public int? AnimalTypeID { get; set; }

[Display(Name = "Spesie")]

public AnimalType AnimalType { get; set; }

public bool Male { get; set; }

public bool Trophy { get; set; }

public int Quantity { get; set; }

[DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "R{0:N}")]

public decimal Price { get; set; }

[StringLength(2000)]

public string Comments { get; set; }

为什么MySQL不喜欢这些定义?或者它试图做的转换是什么?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值