deletestatement.cs

来自「.net的数据持久层」· CS 代码 · 共 56 行

CS
56
字号
using System;

namespace Platform.Data {

	public class DeleteStatement : StatementBase {

		public DeleteStatement() : base() {
		}
		public DeleteStatement(object obj) : base( obj ){
		}
		public DeleteStatement(object obj,string _TName) : base( obj ,_TName)
		{
		}
		public override void BuildSqlClause() {
			this.WhereString = this.BuildWhereString();
			this.SqlClause = String.Format(
				"DELETE FROM {0} WHERE {1}", this.TableName, this.WhereString );
		}

		public override void FillDataParameter(object obj) {
			foreach(FieldProp fp in this.Fields ){
				if( fp.IsKeyField ){
					DataParameter dp = this.Parameters[ fp.FieldName ];
					if( fp.Size != 0 ){
						dp.Size = fp.Size;
					}
					dp.Value = fp.GetValue( obj );
				}
			}
		}


		public override StatementBase Create() {
			return new DeleteStatement();
		}

		public void Perform( CriteriaCollection cts)
		{
//			if( cts != null )
//			{
//				this.AddCriterias( cts );
//			}			
//			
//
//			string whereString = this.CriteriaString.Length > 0 ? " WHERE " + this.CriteriaString : "";
//			string sql = String.Format( "delete FROM {0} where {1}",
//				this.TableName,
//				whereString);
//
//			this.SqlClause = sql;
		}

		
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?