Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (37 sloc) 1.525 kB
using System;
using System.Collections.Generic;
using System.Text;
using Simple.Data.Ado.Schema;
namespace Simple.Data.Ado
using System.Linq;
internal class FindHelper
private readonly DatabaseSchema _schema;
private readonly ICommandBuilder _commandBuilder;
private readonly IExpressionFormatter _expressionFormatter;
public FindHelper(DatabaseSchema schema)
_schema = schema;
_commandBuilder = new CommandBuilder(schema);
_expressionFormatter = new ExpressionFormatter(_commandBuilder, _schema);
public ICommandBuilder GetFindByCommand(ObjectName tableName, SimpleExpression criteria)
if (criteria != null)
_commandBuilder.Append(" ");
_commandBuilder.Append(string.Join(" ", new Joiner(JoinType.Inner, _schema).GetJoinClauses(tableName, criteria)));
_commandBuilder.Append(" where ");
return _commandBuilder;
private string GetSelectClause(ObjectName tableName)
var table = _schema.FindTable(tableName);
return string.Format("select {0} from {1}", string.Join(", ", table.Columns.Select(c => c.QualifiedName)), table.QualifiedName);
Jump to Line
Something went wrong with that request. Please try again.