问题过程
终端执行 dotnet ef migrations add init
出现如下错误:
Pomelo.EntityFrameworkCore.MySql
Microsoft.EntityFrameworkCore.Tools
Unable to create a 'DbContext' of type ''. The exception 'Method not found: 'Void CoreTypeMappingParameters..ctor(System.Type, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, System.Func`3<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator>)'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
解决
在nuget上重新搜了相关的包,然后配置如下:
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
问题得到解决:
- CodeFirst DbContext Unable create mysqlcodefirst dbcontext unable create launcher process unable create outofmemoryerror create unable native 错误process unable create codefirst mysql core create table mysql like procedure create mysql table create insert select mysql procedure parameters create mysql dbcontext