public IParameterQueryable Parameter(string paramId, object value) { currentParamId = paramId; commandEngine.AddConfiguration(command => { var param = command.CreateParameter(); param.ParameterName = paramId; param.Value = value; param.DbType = DbTypeConverter.From(value.GetType()); command.Parameters.Add(param); Parameters.Add(param.ParameterName, param); }); return(this); }
public IParameterQueryable <TItem> Parameter(string paramId, Func <TItem, object> createValue) { currentParamId = paramId; commandEngine.AddParamConfiguration((command, item) => { var value = createValue(item); if (command.Parameters.Contains(paramId)) { command.Parameters[paramId].Value = value; command.Parameters[paramId].DbType = DbTypeConverter.From(value.GetType()); } else { var parameter = command.CreateParameter(); parameter.ParameterName = paramId; parameter.Value = value; parameter.DbType = DbTypeConverter.From(value.GetType()); command.Parameters.Add(parameter); } }); return(this); }