private bool Save(out PersistCommand command) { switch (this.TableName) { case DbStructure.OracleOrganizationTableName: { return(this.InvokeCommandPatternForSave <MsOrganizationRow>(new OrganizationPersistCommand(this), out command)); } default: return(this.InvokeCommandPatternForSave <IGuidIdentity>(null, out command)); } ; }
private bool InvokeCommandPatternForSave <TG>(PersistCommand persistCommand, out PersistCommand command) where TG : IGuidIdentity { if (persistCommand == null) { command = null; return(false); } command = persistCommand; command.Execute <TG>(); return(true); }
public override void Execute() { // Create the sub-tasks. if (BuildParameters == null) { BuildParameters = new BuildParametersUsing <T>(); } BuildParameters.CommandWithParameters = PersistCommand; BuildParameters.ObjectWithValues = ObjectToPersist; BuildParameters.Execute(); var rowsPersisted = PersistCommand.ExecuteNonQuery(); if (rowsPersisted != 1) { throw new ObjectPersistanceException(String.Format("Expected 1 row to be persisted, but actual count was {0}.", rowsPersisted)); } }