You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Migration not generated due to single DU (PageId)
To Reproduce
moduleDatabaseopenSystem.ComponentModel.DataAnnotationsopenSystem.ComponentModel.DataAnnotations.SchemaopenMicrosoft.EntityFrameworkCoreopenEntityFrameworkCore.FSharp.ExtensionsopenMicrosoft.EntityFrameworkCore.DesigntypeContentId= ContentId ofinttypePageId= PageId ofint// some other entities[<CLIMutable>]typeContent={[<Key>] Id:ContentId
PageId:PageId option
ParentId:int option[<NotMapped>]
Parent:Content optional}typeConstructorContext(options : DbContextOptions<ConstructorContext>)=inherit DbContext(options)[<DefaultValue>]val mutablecontents:DbSet<Content>memberthis.Contentswith get()= this.contents andset v = this.contents <- v
override_.OnModelCreating builder =
builder.RegisterOptionTypes()// enables option values for all entities
builder.RegisterSingleUnionCases()// enables single case unions for all entitiesoverride_.OnConfiguring(options:DbContextOptionsBuilder):unit =
options
.UseNpgsql(connectionString)
.UseFSharpTypes()// enable queries for F# types|> ignore
typeApplicationDbContextFactory()=interface IDesignTimeDbContextFactory<ConstructorContext>withmember_.CreateDbContext(_:string[])=letoptionsBuilder= DbContextOptionsBuilder<ConstructorContext>()
optionsBuilder.UseNpgsql(connectionString)|> ignore
new ConstructorContext(optionsBuilder.Options)
I have an Exception after dotnet ef migrations add Init
The property 'Content.PageId' is of type 'PageId' which is not supported by the current database provider. Either change the property CLR type, or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder. Ignore' in 'OnModelCreating'.
UPD.: as I can see, this error appears only if field is single DU AND option
UPD. [2]: when I try to create Parent optional field (with NotMapped attribute) i get an error: The property 'Content.Parent' is of type 'Content' which is not supported by the current database provider. Either change the property CLR type, or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder .Ignore' in 'OnModelCreating'.
But if I remove option - the errror dissapears.
The text was updated successfully, but these errors were encountered:
brud
changed the title
Migration not generated due to single DU
Migration not generated due to optional single case DU
Jul 25, 2022
Describe the bug
Migration not generated due to single DU (PageId)
To Reproduce
I have an Exception after
dotnet ef migrations add Init
The property 'Content.PageId' is of type 'PageId' which is not supported by the current database provider. Either change the property CLR type, or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder. Ignore' in 'OnModelCreating'.
UPD.: as I can see, this error appears only if field is single DU
AND
optionUPD. [2]: when I try to create
Parent
optional field (with NotMapped attribute) i get an error:The property 'Content.Parent' is of type 'Content' which is not supported by the current database provider. Either change the property CLR type, or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder .Ignore' in 'OnModelCreating'.
But if I remove
option
- the errror dissapears.The text was updated successfully, but these errors were encountered: