Browse Source

-

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
a2812eae8a
  1. 2
      Src/Asp.Net/SqlServerTest/UnitTest/EnumTest.cs
  2. 4
      Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs

2
Src/Asp.Net/SqlServerTest/UnitTest/EnumTest.cs

@ -20,7 +20,7 @@ namespace OrmTest.UnitTest
var db = GetInstance();
var shoolValue = SchoolEnum.HarvardUniversity;
var enums = new SchoolEnum[] { shoolValue, SchoolEnum.UniversityOfOxford };
var list = db.Queryable<StudentEnum>().AS("student").Where(it => it.SchoolId == shoolValue).ToList();
var list = db.Queryable<StudentEnum>().AS("student").Where(it => it.SchoolId == shoolValue).Select(it=>it.SchoolId).ToList();
var x = new StudentEnum()
{

4
Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs

@ -123,6 +123,10 @@ namespace SqlSugar
{
reval.Add(default(T));
}
else if (type.IsEnum)
{
reval.Add((T)Enum.Parse(type,value.ObjToString()));
}
else
{
reval.Add((T)Convert.ChangeType(value, UtilMethods.GetUnderType(type)));

Loading…
Cancel
Save