1. patch ETL to convert Enums

2. drop the ENUM in favor of a string property flag
public string EntryType {get;set;}

3. add a get/set string property so the row can be mapped to the
object. and have a readonly Enum property to convert the string to an
enum
public string EntryTypeAsString {get;set;}
public EntryType EntryType
{
      get
      {
            var value = Enum.Parse(typeof(EntryType),
EntryTypeAsString);
            return (EntryType)value;
      }
}

With this being an ETL operation, I would go with option 2.

On Apr 16, 11:25 am, LOBOMINATOR <[email protected]> wrote:
> Hello
>
> I have
>
>     public enum EntryType
>     {
>         File,
>         Directory,
>     }
>
>         public class Entry
>         {
>             public string Name
>             {
>                 get;
>                 set;
>             }
>
>             public EntryType EntryType
>             {
>                 get;
>                 set;
>             }
>
>             public long Size
>             {
>                 get;
>                 set;
>             }
>
>             public DateTime Created
>             {
>                 get;
>                 set;
>             }
>         }
>
> //Operation
>             foreach (Row row in rows)
>             {
>                // Row contains "EntryType" = EntryType.Directory
>                 var entry = row.ToObject<Entry>();
>
>                 // After ToObject<Entry> EntryType is EntryType.File
> which is wrong
>                 if (entry.EntryType == EntryType.File)
>                 {
>                      yield return row;
>                 }
>             }
>
> It seems that ToObject in combination with enum used the default enum
> type which is not correct.
>
> Any suggestions?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Rhino Tools Dev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rhino-tools-dev?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to