Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
245bfda20f
  1. 13
      SqlSugar/Abstract/Core/DbBind/IDataReaderEntityBuilder.cs

13
SqlSugar/Abstract/Core/DbBind/IDataReaderEntityBuilder.cs

@ -15,6 +15,7 @@ namespace SqlSugar
/// </summary> /// </summary>
public partial class IDataReaderEntityBuilder<T> public partial class IDataReaderEntityBuilder<T>
{ {
#region Properies
private SqlSugarClient Context = null; private SqlSugarClient Context = null;
private IDataReaderEntityBuilder<T> DynamicBuilder; private IDataReaderEntityBuilder<T> DynamicBuilder;
private IDataRecord DataRecord; private IDataRecord DataRecord;
@ -22,6 +23,9 @@ namespace SqlSugar
private IDataReaderEntityBuilder() private IDataReaderEntityBuilder()
{ {
} }
#endregion
#region Constructor
public IDataReaderEntityBuilder(SqlSugarClient context, IDataRecord dataRecord) public IDataReaderEntityBuilder(SqlSugarClient context, IDataRecord dataRecord)
{ {
@ -30,7 +34,9 @@ namespace SqlSugar
this.DynamicBuilder = new IDataReaderEntityBuilder<T>(); this.DynamicBuilder = new IDataReaderEntityBuilder<T>();
this.ReaderKeys = new List<string>(); this.ReaderKeys = new List<string>();
} }
#region fields #endregion
#region Fields
private static readonly MethodInfo isDBNullMethod = typeof(IDataRecord).GetMethod("IsDBNull", new Type[] { typeof(int) }); private static readonly MethodInfo isDBNullMethod = typeof(IDataRecord).GetMethod("IsDBNull", new Type[] { typeof(int) });
private static readonly MethodInfo getValueMethod = typeof(IDataRecord).GetMethod("get_Item", new Type[] { typeof(int) }); private static readonly MethodInfo getValueMethod = typeof(IDataRecord).GetMethod("get_Item", new Type[] { typeof(int) });
private static readonly MethodInfo getBoolean = typeof(IDataRecord).GetMethod("GetBoolean", new Type[] { typeof(int) }); private static readonly MethodInfo getBoolean = typeof(IDataRecord).GetMethod("GetBoolean", new Type[] { typeof(int) });
@ -64,6 +70,7 @@ namespace SqlSugar
private Load handler; private Load handler;
#endregion #endregion
#region Public methods
public T Build(IDataRecord dataRecord) public T Build(IDataRecord dataRecord)
{ {
return handler(dataRecord); return handler(dataRecord);
@ -119,6 +126,9 @@ namespace SqlSugar
DynamicBuilder.handler = (Load)method.CreateDelegate(typeof(Load)); DynamicBuilder.handler = (Load)method.CreateDelegate(typeof(Load));
return DynamicBuilder; return DynamicBuilder;
} }
#endregion
#region Private methods
private void BindClass(ILGenerator generator, LocalBuilder result, PropertyInfo propertyInfo) private void BindClass(ILGenerator generator, LocalBuilder result, PropertyInfo propertyInfo)
{ {
@ -303,5 +313,6 @@ namespace SqlSugar
throw new SqlSugarException(string.Format("{0} can't convert {1} to {2}", propertyName, transformedPropertyName, objType)); throw new SqlSugarException(string.Format("{0} can't convert {1} to {2}", propertyName, transformedPropertyName, objType));
} }
} }
#endregion
} }
} }

Loading…
Cancel
Save