At one point, SimpleRepository didn't support enums. If you had a POCO object with an Enum it wouldn't persist correctly, you had to have a backing variable which you would use eg:
public enum Color
{
Red = 1,
Blue = 2
}
public class Car
{
[SubSonicIgnore]
public Color CarColor
{
get
{
return (Color)ColorMe;
}
set
{
ColorMe= (int)value;
}
}
public int ColorMe;
}
The name in your table would then have to be the named of the variable, and not the enum.
This issue was resolved with a recent patch on github.
However, I'm still seeing issues when trying to use GetPaged
var results = Db.GetPaged<Car>(1, 10);
Throws an exception:
**Tests.Models.NewTests.SimplePagedSearch threw exception: System.InvalidCastException: Invalid cast from 'System.Int32' to 'Models.Car.Color**
This exception occurs at line 95 of
SubSonic.Extensions.Objects.ChangeTypeTo(Object value, Type conversionType) in C:\TEMP\subsonic\SubSonic.Core\Extensions\Objects.cs: line 95