fsprojects / FSharp.Azure.Storage

F# API for using Microsoft Azure Table Storage service
MIT License
75 stars 16 forks source link

Unable to use enum types as record property #33

Closed aaronpowell closed 5 years ago

aaronpowell commented 5 years ago

Description

It's not possible to store a type with an enum type property and then retrieve the entity. When you use it it'll blow up on this line: https://github.com/fsprojects/FSharp.Azure.Storage/blob/master/src/FSharp.Azure.Storage/Table.fs#L109-L110 because it comes back as a string which doesn't match the property type.

Repro steps

Create a record with an enum property:

type EnumProp = A | B
type Store =
        { [<PartitionKey>] Pk: string
          [<RowKey]> Rk: string
          Ep: EnumProp }

Insert a record of this type and try and retrieve it it will fail.

Expected behavior

You can use enum properties.

Actual behavior

Enum properties result in a failure on this line: https://github.com/fsprojects/FSharp.Azure.Storage/blob/master/src/FSharp.Azure.Storage/Table.fs#L109-L110

Known workarounds

Just use string properties.

Related information

Using the 3.x version from NuGet.

aaronpowell commented 5 years ago

I've created PR #34 which I'm pretty confident fixes this issue.

daniel-chambers commented 5 years ago

This isn't so much a bug, but a missing feature. I'm very glad to have your PR either way though! Thanks! :)

daniel-chambers commented 5 years ago

Looks like we forgot to close this issue when #34 was merged. Closed and implemented!