关于SQL语句的自动生成!(二)
2008-04-02 09:20 $等待$ 阅读(140) 评论(0) 收藏 举报
基类实现接口,通过基类的实现,从而有效的实现的代码屏蔽。
private abstract class BaseClause : IClause
{
private string m_strTable = string.Empty;
private Where m_oWhere = new Where();

protected BaseClause()
{
this.m_strTable = string.Empty;
this.Clear();
}

public virtual void Add(string name, object val)
{
}

public void AddWhere(string name, object val)
{
this.m_oWhere.Add(name, val);
}

public void Clear()
{
this.m_oWhere.Clear();
this.auxClear();
}

public string TableName
{
set { this.m_strTable = value; }
protected get { return this.m_strTable; }
}

public sealed override string ToString()
{
return this.ToStr + this.m_oWhere.ToString();
}

protected abstract string ToStr { get;}
protected virtual void auxClear() { }
}
private abstract class BaseClause : IClause
{
private string m_strTable = string.Empty;
private Where m_oWhere = new Where();
protected BaseClause()
{
this.m_strTable = string.Empty;
this.Clear();
}
public virtual void Add(string name, object val)
{
}
public void AddWhere(string name, object val)
{
this.m_oWhere.Add(name, val);
}
public void Clear()
{
this.m_oWhere.Clear();
this.auxClear();
}
public string TableName
{
set { this.m_strTable = value; }
protected get { return this.m_strTable; }
}
public sealed override string ToString()
{
return this.ToStr + this.m_oWhere.ToString();
}
protected abstract string ToStr { get;}
protected virtual void auxClear() { }
}
浙公网安备 33010602011771号