Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Enum types #16

Open
tmenezes opened this issue Mar 15, 2024 · 0 comments
Open

Not working with Enum types #16

tmenezes opened this issue Mar 15, 2024 · 0 comments

Comments

@tmenezes
Copy link

tmenezes commented Mar 15, 2024

Could not get it to work with enum types. Perhaps missing how the setup is done for enums...
Also the two different serializers part adds up complexity making it difficult to understand when to use what.

Stacktrace:

System.ArgumentException: Object of type 'System.String' cannot be converted to type 'Some.Namespace.Models.MyEnum'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(StackAllocedArguments& stackArgs, ReadOnlySpan`1 parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.InvokeOneParameter(Object obj, BindingFlags invokeAttr, Binder binder, Object parameter, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at TableStorage.Abstractions.TableEntityConverters.EntityConvert.FillProperties[T](TableEntity entity, T o, List`1 properties, JsonSerializerSettings jsonSerializerSettings, PropertyConverters`1 propertyConverters)
   at TableStorage.Abstractions.TableEntityConverters.EntityConvert.FromTableEntity[T,TP,TR](TableEntity entity, Expression`1 partitionProperty, Func`2 convertPartitionKey, Expression`1 rowProperty, Func`2 convertRowKey, JsonSerializerSettings jsonSerializerSettings, PropertyConverters`1 propertyConverters)
   at TableStorage.Abstractions.TableEntityConverters.EntityConvert.FromTableEntity[T,TP,TR](TableEntity entity, Expression`1 partitionProperty, Expression`1 rowProperty, JsonSerializerSettings jsonSerializerSettings, PropertyConverters`1 propertyConverters)
   at TableStorage.Abstractions.POCO.SimpleKeysConverter`3.FromEntity(TableEntity entity)
   at TableStorage.Abstractions.POCO.PocoTableStore`3.CreateRecord(TableEntity entity)

Info: The column in the Table Storage for the enum property is type string and was added manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant