HI,
I have the following class with a guid Id. I've stripped out all other properties to excluded them as potential causes of error.
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
I have also tried using the [Key] attribute, or configuring instead in onModelBuilding
Unfortunately, i get the following stack trace:
System.InvalidOperationException: No mapping to a relational type can be found for the CLR type 'Microsoft.EntityFrameworkCore.Metadata.Internal.Property'
at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapperExtensions.GetMapping(IRelationalTypeMapper typeMapper, IProperty property)
at MySQL.Data.EntityFrameworkCore.Migrations.MySQLMigrationsSqlGenerator.ColumnDefinition(String schema, String table, String name, Type clrType, String type, Nullable`1 unicode, Nullable`1 maxLength, Boolean rowVersion, Boolean nullable, Object defaultValue, String defaultValueSql, String computedColumnSql, IAnnotatable annotatable, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.ColumnDefinition(AddColumnOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(CreateTableOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model)
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateTables()
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()
at RaceOrganisation.Data.MySql.RaceOrganisationContext..ctor(DbContextOptions`1 options) in C:\Development\RaceOrganisation.Web - Copy\RaceOrganisation.Data.MySql\RaceOrganisationContext.cs:line 16}
When trying to call Database.EnsureCreated.
Any ideas? Thanks.
I have the following class with a guid Id. I've stripped out all other properties to excluded them as potential causes of error.
//[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }
I have also tried using the [Key] attribute, or configuring instead in onModelBuilding
Unfortunately, i get the following stack trace:
System.InvalidOperationException: No mapping to a relational type can be found for the CLR type 'Microsoft.EntityFrameworkCore.Metadata.Internal.Property'
at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapperExtensions.GetMapping(IRelationalTypeMapper typeMapper, IProperty property)
at MySQL.Data.EntityFrameworkCore.Migrations.MySQLMigrationsSqlGenerator.ColumnDefinition(String schema, String table, String name, Type clrType, String type, Nullable`1 unicode, Nullable`1 maxLength, Boolean rowVersion, Boolean nullable, Object defaultValue, String defaultValueSql, String computedColumnSql, IAnnotatable annotatable, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.ColumnDefinition(AddColumnOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(CreateTableOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model)
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateTables()
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()
at RaceOrganisation.Data.MySql.RaceOrganisationContext..ctor(DbContextOptions`1 options) in C:\Development\RaceOrganisation.Web - Copy\RaceOrganisation.Data.MySql\RaceOrganisationContext.cs:line 16}
When trying to call Database.EnsureCreated.
Any ideas? Thanks.