110,534
社区成员
发帖
与我相关
我的任务
分享
public interface IDataFetch()
{
DataTable FetchData();
}
public class Decorator : IDataFetch
{
protected IDataFetch _decoratee = null;
public Decorator(IDataFetch decoratee)
{
_decoratee = decoratee;
}
public virtual DataTable FetchData()
{
if (this._decoratee == null)
throw new Exception("");
return _decoratee.FetchData(interest);
}
}
public class theFetch : IDataFetch
{
public DataTable FetchData()
{
tbl = ....;
return tbl;
}
}
public Decorator1: Decorator
{
public Action1( IDataFetch dee) :base(dee){}
public override DataTable FetchData()
{
DataTable tbl = base.FetchData();
foreach ( DataRow row in tbl.rows)
{
//execute action1 decorator
...
}
}
}
public Decorator2: Decorator
{
public Action2( IDataFetch dee) :base(dee){}
public override DataTable FetchData()
{
DataTable tbl = base.FetchData();
foreach ( DataRow row in tbl.rows)
{
//execute action2 decorator
...
}
}
}