public IEnumerable<IDictionary<string, object>> Find(string tableName, SimpleExpression criteria) { if (criteria == null) return FindAll(tableName); var commandBuilder = new FindHelper(_schema).GetFindByCommand(tableName, criteria); return ExecuteQuery(commandBuilder); }
public Func<object[],IDictionary<string,object>> CreateFindOneDelegate(string tableName, SimpleExpression criteria) { if (criteria == null) { return _ => FindAll(_adapter.GetSchema().BuildObjectName(tableName)).FirstOrDefault(); } var commandBuilder = new FindHelper(_adapter.GetSchema()) .GetFindByCommand(_adapter.GetSchema().BuildObjectName(tableName), criteria); var command = commandBuilder.GetCommand(_adapter.CreateConnection(), _adapter.AdoOptions); command = _adapter.CommandOptimizer.OptimizeFindOne(command); var commandTemplate = commandBuilder.GetCommandTemplate( _adapter.GetSchema().FindTable(_adapter.GetSchema().BuildObjectName(tableName))); var cloneable = command as ICloneable; if (cloneable != null) { return args => ExecuteSingletonQuery((IDbCommand)cloneable.Clone(), args, commandTemplate.Index); } else { return args => ExecuteSingletonQuery(commandTemplate, args); } }
public Func <object[], IDictionary <string, object> > CreateFindOneDelegate(string tableName, SimpleExpression criteria) { if (criteria == null) { return(_ => FindAll(_adapter.GetSchema().BuildObjectName(tableName)).FirstOrDefault()); } var commandBuilder = new FindHelper(_adapter.GetSchema()) .GetFindByCommand(_adapter.GetSchema().BuildObjectName(tableName), criteria); var command = commandBuilder.GetCommand(_adapter.CreateConnection(), _adapter.AdoOptions); command = _adapter.CommandOptimizer.OptimizeFindOne(command); var commandTemplate = commandBuilder.GetCommandTemplate( _adapter.GetSchema().FindTable(_adapter.GetSchema().BuildObjectName(tableName))); var cloneable = command as ICloneable; if (cloneable != null) { return(args => ExecuteSingletonQuery((IDbCommand)cloneable.Clone(), args, commandTemplate.Index)); } else { return(args => ExecuteSingletonQuery(commandTemplate, args)); } }
public IEnumerable <IDictionary <string, object> > Find(string tableName, SimpleExpression criteria) { if (criteria == null) { return(FindAll(ObjectName.Parse(tableName))); } var commandBuilder = new FindHelper(_adapter.GetSchema()).GetFindByCommand(ObjectName.Parse(tableName), criteria); return(ExecuteQuery(commandBuilder)); }