Esempio n. 1
0
 public System_User FirstOrDefault(Expression <Func <System_User, bool> > expression)
 {
     return(_excuteEntity.Excute(connection =>
     {
         return connection.QuerySet <System_User>()
         .Where(expression)
         .Get();
     }));
 }
 public T GetByID(TKey id)
 {
     return(_excuteEntity.Excute(connection =>
     {
         return connection.QuerySet <T>()
         .Where(x => x.PKID.Equals(id))
         .Get();
     }));
 }
 public T Get(int id)
 {
     return(_excuteEntity.Excute(connection =>
     {
         var attrs = typeof(T).GetCustomAttributes(typeof(MappingTableAttribute), true);
         var attr = (MappingTableAttribute)attrs.FirstOrDefault();
         var sql = $"select * from {attr.TableName} where PKID = {id}";
         Console.WriteLine(sql);
         return connection.Query <T>(sql);
     }).FirstOrDefault());
 }