public ReturnValue getEntityList(string sql) { ReturnValue _result = new ReturnValue(); _result.SQLText = sql; _result.Success = true; try { EntityList _datalist = new EntityList(); DataFactory _dal = this.getDataFactory(); DataTable dt = _dal.getDataTable(sql); foreach (DataRow dr in dt.Rows) { NEntity _item = this._oEntity.BindDataToNEntity(dr); _datalist.Add(_item); } _result.ObjectList = _datalist; } catch (DBException exa) { _result.ObjectList = new EntityList(); _result.Success = false; _result.ErrMessage = exa.ToString() + "---" + _globalErrorHandler.ExceptionToString(exa); _result.Code = exa.ErrorCode; } catch (Exception ex) { _result.ObjectList = new EntityList(); _result.Success = false; _result.ErrMessage = ex.Message + "--" + ex.InnerException + "--" + ex.StackTrace + "---" + _globalErrorHandler.ExceptionToString(ex); } return(_result); }
public ReturnValue getEntity(string sql) { ReturnValue _result = new ReturnValue(); _result.SQLText = sql; _result.Success = true; try { DataFactory _dal = this.getDataFactory(); DataTable dt = _dal.getDataTable(sql); // NEntity _item = Activator.CreateInstance(EntityType) as NEntity; NEntity _item = Helper.CreateNewEntityInstanceOf(EntityType) as NEntity; _item.TableName = _oEntity.TableName; if (dt.Rows.Count > 0) { _item = this._oEntity.BindDataToNEntity(dt.Rows[dt.Rows.Count - 1]); } _result.Object = _item; } catch (DBException exa) { _result.Object = Helper.CreateNewEntityInstanceOf(EntityType); _result.Success = false; _result.ErrMessage = exa.ToString(); _result.ErrMessage = exa.ToString() + "---" + _globalErrorHandler.ExceptionToString(exa) + "---" + sql; _result.Code = exa.ErrorCode; } catch (Exception ex) { _result.Object = Helper.CreateNewEntityInstanceOf(EntityType); _result.Success = false; _result.ErrMessage = ex.Message + "--" + ex.InnerException + "--" + ex.StackTrace + "--" + _globalErrorHandler.ExceptionToString(ex) + "---" + sql; } return(_result); }
public NGateway(NEntity o, Transaction trans) { underGateway(o.DataConnectProviders); this._oEntity = o; this._trans = trans; }
/// <summary> /// Constructor of gateway. /// </summary> /// <param name="registryKeyValue">the registry key value of data connection string.</param> /// <param name="objectEntity">Object entity.</param> /// <param name="connectionString">the connection string key of data connection string.</param> public NGateway(NEntity o) { underGateway(o.DataConnectProviders); this._oEntity = o; }