private static hierarchy3a ORM_CreateProxy(System.Data.IDataReader result, System.Collections.Generic.IDictionary <string, int> ordinals) { return(new hierarchy3a() { pid = result.IsDBNull(ordinals["pid"]) ? new Guid() : result.GetGuid(ordinals["pid"]), fid = result.IsDBNull(ordinals["fid"]) ? 0 : result.GetInt64(ordinals["fid"]), uid = result.IsDBNull(ordinals["uid"]) ? new Guid() : result.GetGuid(ordinals["uid"]), numfield1 = result.IsDBNull(ordinals["numfield1"]) ? 0 : result.GetInt32(ordinals["numfield1"]), numfield2 = result.IsDBNull(ordinals["numfield2"]) ? 0 : result.GetInt32(ordinals["numfield2"]), numfield3 = result.IsDBNull(ordinals["numfield3"]) ? 0 : result.GetInt32(ordinals["numfield3"]), textfield1 = result.IsDBNull(ordinals["textfield1"]) ? null : result.GetString(ordinals["textfield1"]), textfield2 = result.IsDBNull(ordinals["textfield2"]) ? null : result.GetString(ordinals["textfield2"]), textfield3 = result.IsDBNull(ordinals["textfield3"]) ? null : result.GetString(ordinals["textfield3"]) }); //var obj = new hierarchy3a(); //obj.pid = result.IsDBNull(ordinals["pid"]) ? new Guid() : result.GetGuid(ordinals["pid"]), //obj.fid = result.IsDBNull(ordinals["fid"]) ? 0 : result.GetInt64(ordinals["fid"]), //obj.uid = result.IsDBNull(ordinals["uid"]) ? new Guid() : result.GetGuid(ordinals["uid"]), //obj.numfield1 = result.IsDBNull(ordinals["numfield1"]) ? 0 : result.GetInt32(ordinals["numfield1"]), //obj.numfield2 = result.IsDBNull(ordinals["numfield2"]) ? 0 : result.GetInt32(ordinals["numfield2"]), //obj.numfield3 = result.IsDBNull(ordinals["numfield3"]) ? 0 : result.GetInt32(ordinals["numfield3"]), //obj.textfield1 = result.IsDBNull(ordinals["textfield1"]) ? null : result.GetString(ordinals["textfield1"]), //obj.textfield2 = result.IsDBNull(ordinals["textfield2"]) ? null : result.GetString(ordinals["textfield2"]), //obj.textfield3 = result.IsDBNull(ordinals["textfield3"]) ? null : result.GetString(ordinals["textfield3"]) //return obj; }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif Id = childData.GetGuid(0); ConstrainedValueListId = childData.GetGuid(1); Value = childData.GetString(2); Description = childData.GetString(3); Ordinal = childData.GetInt32(4); LastChanged = childData.GetDateTime(5); // TODO(crhodes): Added this to try to get things to not be dirty. MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
public static Guid?GetGuidNullable(System.Data.IDataReader dataReader, int i) { if (dataReader.IsDBNull(i)) { return(null); } return(dataReader.GetGuid(i)); }
/// <summary> /// 直接从dataReader中读取第i列的值 /// </summary> /// <param name="dataReader">要读取数据的dataReader</param> /// <param name="i">dataReader中的列索引</param> /// <returns></returns> public static Guid GetGuid(System.Data.IDataReader dataReader, int i) { if (dataReader.IsDBNull(i)) { return(Guid.Empty); } return(dataReader.GetGuid(i)); }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif Id = childData.GetGuid(0); Name = childData.GetString(1); TypeId = childData.GetGuid(2); LastChanged = childData.GetDateTime(3); LoadProperty(AttributeValuesECLProperty, AttributeValuesECL.Get(Id)); // TODO(crhodes): Added this to try to get things to not be dirty. MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif Id = childData.GetGuid(0); TableId = childData.GetInt32(1); ItemId = childData.GetGuid(2); TypeAttributeId = childData.GetGuid(3); Value = childData.GetString(4); LastChanged = childData.GetDateTime(5); // TODO(crhodes): Added this to try to get things to not be dirty. MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif // First get the data from the retrieved record Id = childData.GetGuid(0); Name = childData.GetString(1); TypeId = childData.GetGuid(2); LastChanged = childData.GetDateTime(3); TypeName = childData.GetString(4); Characteristics = childData.GetInt32(5); Version = childData.GetInt32(6); MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif // First get the data from the retrieved record Id = childData.GetGuid(0); Name = childData.GetString(1); TypeId = childData.GetGuid(2); LastChanged = childData.GetDateTime(3); // Then call the Schema to get other information TypeName = HIS.Library.Common.HISSchema.GetTypeName(TypeId); Characteristics = HIS.Library.Common.HISSchema.GetTypeCharacteristics(TypeId); Version = HIS.Library.Common.HISSchema.GetTypeVersion(TypeId); MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
public static Guid Guid(System.Data.IDataReader reader, MapPoint mapPoint, Guid defaultValue) { try { if (mapPoint.IsInResultSet() && !reader.IsDBNull(mapPoint.Index)) { if (mapPoint.Type == System.Data.SqlDbType.UniqueIdentifier) { return(reader.GetGuid(mapPoint.Index)); } else { return(new Guid(reader.GetValue(mapPoint.Index).ToString())); } } } catch (Exception) { throw; } return(defaultValue); }
public void SetFromReader <T>(T obj, System.Data.IDataReader reader, Action <T, string, object> setMethod) where T : class { if (!reader.IsDBNull(this.Index)) { switch (this.SqlType) { case System.Data.SqlDbType.BigInt: setMethod(obj, FieldName, reader.GetInt64(this.Index)); break; case System.Data.SqlDbType.Image: case System.Data.SqlDbType.VarBinary: case System.Data.SqlDbType.Binary: long size = reader.GetBytes(this.Index, 0, null, 0, 0); byte[] values = new byte[size]; int bufferSize = 1024; long bytesRead = 0; int curPos = 0; while (bytesRead < size) { bytesRead += reader.GetBytes(this.Index, curPos, values, curPos, bufferSize); curPos += bufferSize; } setMethod(obj, FieldName, values); break; case System.Data.SqlDbType.Bit: setMethod(obj, FieldName, reader.GetBoolean(this.Index)); break; case System.Data.SqlDbType.Char: setMethod(obj, FieldName, reader.GetChar(this.Index)); break; case System.Data.SqlDbType.SmallDateTime: case System.Data.SqlDbType.Date: case System.Data.SqlDbType.DateTime: case System.Data.SqlDbType.DateTime2: setMethod(obj, FieldName, reader.GetDateTime(this.Index)); break; case System.Data.SqlDbType.SmallMoney: case System.Data.SqlDbType.Money: case System.Data.SqlDbType.Decimal: setMethod(obj, FieldName, reader.GetDecimal(this.Index)); break; case System.Data.SqlDbType.Float: setMethod(obj, FieldName, reader.GetDouble(this.Index)); break; case System.Data.SqlDbType.Int: setMethod(obj, FieldName, reader.GetInt32(this.Index)); break; case System.Data.SqlDbType.Text: case System.Data.SqlDbType.NVarChar: case System.Data.SqlDbType.NText: case System.Data.SqlDbType.VarChar: case System.Data.SqlDbType.NChar: setMethod(obj, FieldName, reader.GetString(this.Index)); break; case System.Data.SqlDbType.Real: setMethod(obj, FieldName, reader.GetFloat(this.Index)); break; case System.Data.SqlDbType.SmallInt: setMethod(obj, FieldName, reader.GetInt16(this.Index)); break; case System.Data.SqlDbType.TinyInt: setMethod(obj, FieldName, reader.GetByte(this.Index)); break; case System.Data.SqlDbType.UniqueIdentifier: setMethod(obj, FieldName, reader.GetGuid(this.Index)); break; default: break; } } else { setMethod(obj, FieldName, null); } }
System.Guid System.Data.IDataRecord.GetGuid(int i) { return(_dataReader.GetGuid(i)); }