コード例 #1
0
 public static SqlExpressCommand Create(string sqlStatement,Query query)
 {
     SqlExpressCommand command = new SqlExpressCommand();
     command.AppendStatement(sqlStatement);
     command.TranslateQuery(query);
     return command;
 }
コード例 #2
0
 private string GenerateCommand(string type)
 {
     ISqlExpressCommandGenerator commandGenerator = SqlExpressCommandGeneratorFactory.Create();
     Query query = new Query();
     query.Criteria.Add(new Criterion("GoodsName", CriteriaOperator.Like, "marcus"));
     Query subQuery = new Query();
     query.SubQueries.Add(subQuery);
     query.Operator = QueryOperator.Or;
     subQuery.Criteria.Add(new Criterion("GoodsId", CriteriaOperator.GreaterThan, 90000));
     SqlExpressCommand command=null;
     if (type == "R")
         command = commandGenerator.GenerateSelectCommand<Goods>(query);
     else if (type == "D")
         command = commandGenerator.GenerateDeleteCommand<Goods>(query);
     return command.Statement.ToString();
 }
コード例 #3
0
 public SqlServerQueryTranslator(SqlExpressCommand sqlCommand, Query query)
 {
     _sqlCommand = sqlCommand;
     _query = query;
 }
コード例 #4
0
 public void TranslateQuery(Query query)
 {
     if (CommandType!=CommandType.Text)
     {
         throw new InvalidOperationException("只能为普通sql语句翻译查询");
     }
     IQueryTranslator translator = QueryTranslatorFactory.Create(this, query);
     translator.Execute();
 }
コード例 #5
0
 public static IQueryTranslator Create(SqlExpressCommand command,Query query)
 {
     return new SqlServerQueryTranslator(command,query);
 }
コード例 #6
0
 public QueryTranslator(ICriteria criteria, Query query)
 {
     _criteria = criteria;
     _query = query;
 }