代码改变世界

关于SQL语句的自动生成!(二)

2008-04-02 09:20  $等待$  阅读(137)  评论(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() { }
        }