Skip to content

Support nullable type and enum conversions on results. Fixed !! #14

@mediabuff

Description

@mediabuff
internal static class DocumentConverterExtensions
{
    private static void SetPropertyValue<T>(PropertyInfo property, T instance, string fieldValue)
        where T : IDocument
    {
        if (!property.CanWrite || property.Name == nameof(IDocument.UniqueKey)) return;

        var propertyType = GetUnderlyingType(property);

        if (propertyType.IsEnum)
        {
            property.SetValue(instance, Enum.ToObject(propertyType, long.Parse(fieldValue)));
        }
	else ....
   }

   ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions