Select New 引发异常 返回

求助
1 1476
该叫什么 Kane 发布于2018/4/14
悬赏:5 飞吻

使用4.6.4.7 用SQLITE数据库 , Select New 会经常报错

SqlSugarException.NotSupportedException: "" Type NotSupported, DbBindProvider.GetPropertyTypeName error.

-------------------------------------------------------------------------------------------------------------

   在 SqlSugar.Check.ThrowNotSupportedException(String message)

   在 SqlSugar.DbBindProvider.GetPropertyTypeName(String dbTypeName)

   在 SqlSugar.IDataReaderEntityBuilder`1.BindMethod(ILGenerator generator, PropertyInfo bindProperty, Int32 ordinal)

   在 SqlSugar.IDataReaderEntityBuilder`1.BindField(ILGenerator generator, LocalBuilder result, PropertyInfo propertyInfo, String fileName)

   在 SqlSugar.IDataReaderEntityBuilder`1.CreateBuilder(Type type)

   在 SqlSugar.DbBindAccessory.<>c__DisplayClass0_0`1.<GetEntityList>b__0()

   在 SqlSugar.ReflectionInoCore`1.GetOrCreate(String cacheKey, Func`1 create)

   在 SqlSugar.ReflectionInoCacheService.GetOrCreate[V](String cacheKey, Func`1 create, Int32 cacheDurationInSeconds)

   在 SqlSugar.DbBindAccessory.GetEntityList[T](SqlSugarClient context, IDataReader dataReader)

   在 SqlSugar.DbBindProvider.DataReaderToList[T](Type type, IDataReader dataReader)

   在 SqlSugar.QueryableProvider`1.GetData[TResult](KeyValuePair`2 sqlObj)

   在 SqlSugar.QueryableProvider`1._ToList[TResult]()

   在 SqlSugar.QueryableProvider`1.ToList()

   在 Cashier.Utils.LocalDAL.GetShiftList() 位置 E:\VSProjects\POS\Cashier\Cashier\Utils\LocalDAL.cs:行号 60

-----------------------------------------------------------------

数据库结构和数据

DROP TABLE IF EXISTS "main"."t_pos_shift";

CREATE TABLE "t_pos_shift" (

"F_ID"  INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

"F_Name"  VARCHAR,

"F_StartTime"  VARCHAR,

"F_EndTime"  VARCHAR

);

-- ----------------------------

-- Records of t_pos_shift

-- ----------------------------

INSERT INTO "main"."t_pos_shift" VALUES (1, 1, '10:00', '16:30');

INSERT INTO "main"."t_pos_shift" VALUES (2, 2, '16:30', '23:59');


----------------------------------------------------

//就是执行这个查询就会报错

 db.Queryable<t_pos_shift>()

.Select(k => new ListIItem 

{

Value = k.F_ID,

Text = SqlFunc.MergeString(k.F_Name, " 【", k.F_StartTime, "~", k.F_EndTime, "】")

 }).ToList();

--------------------------------------------------------

//这是自己建的类

public class ListIItem

    {

        public int Value { get; set; }

        public string Text { get; set; }

    }


---------------------------------------------------------

TIM截图20180414152801.png

热忱回答1

版块

学习文档

最新会员

发布达人

回贴达人