/// <summary> /// 获取唯一 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="lstScope">条件</param> /// <returns></returns> public static T GetUnique <T>(ScopeList lstScope) where T : EntityBase, new() { string name = typeof(T).FullName; BusinessModelBase <T> bo = DataAccessLoader.GetBoInstance(name) as BusinessModelBase <T>; if (bo == null) { throw new MissingMemberException("找不到:" + name + " 对应的业务类"); } return(bo.GetUnique(lstScope)); }
/// <summary> /// 根据ID获取实体 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id">id</param> /// <returns></returns> public static T GetById <T>(object id) where T : EntityBase, new() { string name = typeof(T).FullName; BusinessModelBase <T> bo = DataAccessLoader.GetBoInstance(name) as BusinessModelBase <T>; if (bo == null) { throw new MissingMemberException("找不到:" + name + " 对应的业务类"); } return(bo.GetEntityById(id)); }
/// <summary> /// 获取唯一 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="condition">条件</param> /// <returns></returns> public static T GetUnique <T>(BQLCondition condition) where T : EntityBase, new() { string name = typeof(T).FullName; BusinessModelBase <T> bo = DataAccessLoader.GetBoInstance(name) as BusinessModelBase <T>; if (bo == null) { throw new MissingMemberException("找不到:" + name + " 对应的业务类"); } ScopeList lstScope = new ScopeList(); if (!CommonMethods.IsNull(condition)) { lstScope.Add(condition); } return(bo.GetUnique(lstScope)); }