Closed GoogleCodeExporter closed 9 years ago
It has full support for enums, either as the raw int/byte/etc, or incoming as
strings.
The only caveat: your db data and the enum underlying type must agree (I.e. a
tinyint in the db maps to a byte enum).
Is there a specific case that isn't working?
Original comment by marc.gravell
on 3 Jun 2011 at 6:18
Original comment by marc.gravell
on 3 Jun 2011 at 6:19
After reading your comment I had a look and it seems that the enums were being
stored as string (fluent nhibernate generated). I therefore created a new
convention to make sure these were mapped as int.
My enum is:
public enum SiteState
{
Disabled = 0,
Enabled = 1
}
And this is now correctly stored as an int in my database.
However, I now get the following error:
Conversion failed when converting the nvarchar value 'Enabled' to data type
int.
Any ideas?
Original comment by b...@planetcloud.co.uk
on 3 Jun 2011 at 7:37
Ignore that last one I had a problem with my parameters. I am noticing that I
need to explicitly cast my parameters as int:
new { state = (int)SiteState.Enabled, urlstate = (int)UrlMappingStatus.Active
});
Is this expected?
Original comment by b...@planetcloud.co.uk
on 3 Jun 2011 at 7:44
No, that sounds like a bug with the parameter handling not considering the
underlying type correctly. I will fix that.
Original comment by marc.gravell
on 3 Jun 2011 at 8:54
fixed
Original comment by marc.gravell
on 5 Jun 2011 at 10:12
Hi Marc,
I'm having a similar issue with nullable enums. Unless I cast them as (int?)
when setting the dynamic params it fails with an Type not supported exception.
Chris
Original comment by christop...@gmail.com
on 11 Jun 2011 at 9:34
@Chris - a: do you have repro code / example, and b: what version?
Original comment by marc.gravell
on 11 Jun 2011 at 9:52
@Marc, sorry for wasting your time. I thought I had the latest version as I
only downloaded it on Friday, however I got it from the GitHub clone which
didn't have this fix in it. I just grabbed the latest version from here and its
working.
Thanks for the great object mapper!
Original comment by christop...@gmail.com
on 13 Jun 2011 at 9:45
No problem - thanks for the update
Original comment by marc.gravell
on 13 Jun 2011 at 10:12
Original issue reported on code.google.com by
b...@planetcloud.co.uk
on 3 Jun 2011 at 3:58