Skip to content

Support for empty discriminated union #147

@EspenBrun

Description

@EspenBrun

Hello,

Thanks for this awesome package!

Is your feature request related to a problem? Please describe.
I would like to use an empty discriminated union to hold in my records

type BlogType
    | Essay
    | Long

Describe the solution you'd like
Something like registerEmptyUnionCases(), so I can just use mye EquineBeast DU as normal in by fsharp code.

If a define an Enum, it will be stored as 0, 1, 2 in the database.

Describe alternatives you've considered
If I could define a value converter on the ModelSnapshot that would also solve my problem (although registering in _.OnConfigure once would be much preferred). I have tried something like this with no luck (does not compile)

            b.Property<BlogType>("BlogType")
                .HasMaxLength(16)
                .HasColumnType("char(16)")
                .HasConversion (fun v -> v.ToString(), fun v -> BlogType.fromString v)
                |> ignore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions