/// <summary> /// 读取可空日期型值 /// </summary> /// <param name="row">数据行</param> /// <param name="columns">列集合</param> /// <param name="columnName">列名称</param> /// <returns>日期型结果</returns> protected DateTimeOffset?LoadNullableDateTimeOffset(DataRow row, DataColumnCollection columns, String columnName) { if (columns.Contains(columnName) && !Convert.IsDBNull(row[columnName])) { return(DbConvert.ToDateTimeOffset(row[columnName])); } else { return(null); } }
/// <summary> /// 读取可空日期型值 /// </summary> /// <param name="args">对象创建参数</param> /// <param name="columnName">列名称</param> /// <returns>日期型结果</returns> protected DateTimeOffset?LoadNullableDateTimeOffset(EntityCreatingArgs args, String columnName) { if (args.Columns.Contains(columnName) && !DbConvert.IsDBNull(args.Row[columnName])) { return(DbConvert.ToDateTimeOffset(args.Row[columnName])); } else { return(null); } }