public void AddOperation(UpdateOperation operation)
{
var name = TableName;
if (null != name && operation.TableName != name)
{
throw new ArgumentException(string.Format(
"Table name mismatch for UPDATE command. Expected: {0}. Actual: {1}.",
name,
operation.TableName),
"operation");
}
var pk = PrimaryKeyAsObject;
if (null != pk
&& !PrimaryKeyComparer.SuppliedPrimaryKeyValuesMatch(
operation.OwnerMetadata,
pk,
operation.OwnerPrimaryKeyAsObject))//operation.OwnerPrimaryKey != pk.Value)
{
throw new ArgumentException(string.Format(
"Primary key mismatch for UPDATE command on table {0}. Expected: {1}. Actual: {2}.",
name,
pk,
operation.OwnerPrimaryKeyAsObject),
"operation");
}
name = PrimaryKeyColumn;
if (null != name && operation.OwnerPrimaryKeyColumn != name)
{
throw new ArgumentException(string.Format(
"Primary key column mismatch for UPDATE command on table {0}. Expected: {1}. Actual: {2}.",
TableName,
name,
operation.OwnerPrimaryKeyColumn),
"operation");
}
TableName = operation.TableName;
PrimaryKeyColumn = operation.OwnerPrimaryKeyColumn;
_operations.Add(operation);
}