public virtual string GetSqlCommand()
{
string key =this.GetGuid();
StringBuilder sb = new StringBuilder(" if exists (select * from "+this.GetTableName()+" where "+key+" = '"+this.GetPropertyValue(key)+"')");
sb.AppendLine().Append("Begin");
sb.AppendLine().Append(BuildUpdateCom());
sb.AppendLine().Append("End");
sb.AppendLine().Append("Else");
sb.AppendLine().Append("Begin");
sb.AppendLine().Append( BuildInsertCom());
sb.AppendLine().Append("End");
return sb.ToString();
}