📄 class.format
字号:
/// <summary>
/// Wraps a datarow, exposing it's richest features as properties and methods.
/// </summary>
public abstract class {0}OrmTemplate : Business
{
/// <summary>
/// Default Constructor
/// </summary>
/// <param name="dataContext">The DataManager this object should perform it's operations with</param>
/// <param name="ROW">The underlying row that this object will wrap</param>
internal {0}OrmTemplate( DataManager dataContext, DataRow ROW) : base(dataContext)
{
row = ROW;
}
/// <summary>
/// Gets and sets the property at the underlying row index.
/// </summary>
public object this[int index]
{
get
{
if ( this.row.IsNull(index) )
return null;
else
return this.row[index];
}
set
{
if ( value == null )
this.row[index] = DBNull.Value;
else
this.row[index] = value;
}
}
/// <summary>
/// Gets and sets the property by its name.
/// </summary>
/// <remarks>
/// Do not use the underlying column name if it is different.
/// </remarks>
public object this[string property]
{
get
{
System.Reflection.PropertyInfo pi = this.GetType().GetProperty(property);
if ( pi != null && pi.CanRead )
return pi.GetValue(this, null);
System.Reflection.MethodInfo mi = this.GetType().GetMethod("Get" + property,new System.Type[]{});
if ( mi != null )
return mi.Invoke(this, null);
return null;
}
set
{
System.Reflection.PropertyInfo pi = this.GetType().GetProperty(property);
if ( pi != null && pi.CanWrite )
{
pi.SetValue(this, value, null);
return;
}
System.Reflection.MethodInfo mi = this.GetType().GetMethod("Set" + property,new System.Type[]{value.GetType()});
if ( mi != null )
mi.Invoke(this, new object[]{value});
}
}
/// <summary>
/// Returns true if the underlying DataRow.RowState is marked as DataRowState.Deleted
/// </summary>
/// <returns>true if deleted</returns>
public virtual bool IsDeleted()
{
return row.RowState == DataRowState.Deleted;
}
{1}{2}{3}{4}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -