private void SetKeysAsParameters(String prefix, IVodbCommand command) { command.SetParametersNames(Keys.Select(k => GetParameterName(prefix, k)).ToArray()); }
public IVodbCommand GetUpdateCommand(IVodbCommandFactory factory) { if (_UpdateCommand != null) { return _UpdateCommand; } _UpdateCommand = factory.MakeCommand(SqlUpdate); SetFieldsAsParameters(PARAMETER_PREFIX, _UpdateCommand); SetKeysAsParameters(PARAMETER_PREFIX_OLD, _UpdateCommand); return _UpdateCommand; }
private void SetFieldsAsParameters(String prefix, IVodbCommand command) { command.SetParametersNames(Fields.Where(f => !f.IsIdentity).Select(k => GetParameterName(prefix, k)).ToArray()); }
public IVodbCommand GetSelectByIdCommand(IVodbCommandFactory factory) { if (_SelectByIdCommand != null) { return _SelectByIdCommand; } _SelectByIdCommand = factory.MakeCommand(SqlSelectById); SetKeysAsParameters(PARAMETER_PREFIX, _SelectByIdCommand); return _SelectByIdCommand; }
public IVodbCommand GetSelectAllCommand(IVodbCommandFactory factory) { if (_SelectCommand != null) { return _SelectCommand; } return _SelectCommand = factory.MakeCommand(SqlSelect); }
public IVodbCommand GetInsertCommand(IVodbCommandFactory factory) { if (_InsertCommand != null) { return _InsertCommand; } _InsertCommand = factory.MakeCommand(SqlInsert); SetFieldsAsParameters(PARAMETER_PREFIX, _InsertCommand); return _InsertCommand; }
public IVodbCommand GetDeleteCommand(IVodbCommandFactory factory) { if (_DeleteCommand != null) { return _DeleteCommand; } _DeleteCommand = factory.MakeCommand(SqlDeleteById); SetKeysAsParameters(PARAMETER_PREFIX, _DeleteCommand); return _DeleteCommand; }
public IVodbCommand GetCountCommand(IVodbCommandFactory factory) { if (_CountCommand != null) { return _CountCommand; } return _CountCommand = factory.MakeCommand(SqlCount); }