Beispiel #1
0
 /// <summary>
 /// 读取单个实例
 /// <para>框架</para>
 /// </summary>
 /// <param name="query_condition"></param>
 /// <returns></returns>
 protected bool ReadEntityFrame(Func <DbSet <T>, IQueryable <T> > query_condition)
 {
     if (BlockedByUnsaved())
     {
         return(false);
     }
     try
     {
         CtxEntity  = new Ctx();
         CondEntity = query_condition(CtxEntity.Set <T>());
         Entity     = CondEntity.SingleOrDefault();
         IsNew      = false;
         IsEditing  = false;
         BuildEntityView();
         return(true);
     }
     catch (Exception ex) { return(ReadFailed(ex)); }
 }
Beispiel #2
0
 /// <summary>
 /// 读取单个实例
 /// <para>框架</para>
 /// </summary>
 /// <returns></returns>
 protected bool ReadEntityFrame()
 {
     if (BlockedByUnsaved())
     {
         return(false);
     }
     if (CondEntity == null)
     {
         return(false);
     }
     try
     {
         CtxEntity = new Ctx();
         Entity    = CondEntity.SingleOrDefault();
         IsNew     = false;
         IsEditing = false;
         BuildEntityView();
         return(true);
     }
     catch (Exception ex) { return(ReadFailed(ex)); }
 }