internal static void DatabaseLinqCreateSelectCommand() { SelectCommand command = DbHelper.FakeDb.CreateSelectCommand(_repository.TableName) .Querys <TestEntity>(c => new { c.Test1, c.Test2, c.Test5, c.Test8 }) .Query <TestEntity>(c => c.Test3, "TTTT") .Query <TestEntity>(c => c.Test4, SqlAggregateFunction.Max, "MMMM") .Where <TestEntity>(c => c.Test2 >= 123 || (c.Test5 > 1 && c.Test5 < 10)) .GroupBy <TestEntity>(c => c.Test3) .InnerJoin <TestEntity, TestEntity>(c => c.Test2, d => d.Test2) .OrderBy <TestEntity>(c => c.Test6, SqlOrderType.Asc); DbCommand dbCommand = command.ToDbCommand(); }
public DbCommand SelectTest() { SelectCommand command = this.Select() .Querys <TestEntity>(c => new { c.Test1, c.Test2, c.Test5, c.Test8 }) .Query <TestEntity>(c => c.Test3, "TTTT") .Query <TestEntity>(c => c.Test4, SqlAggregateFunction.Max, "MMMM") .Where <TestEntity>(c => c.Test2 >= 123 || (c.Test5 > 1 && c.Test5 < 10)) .GroupBy <TestEntity>(c => c.Test3) .InnerJoin <TestEntity, TestEntity>(c => c.Test2, d => d.Test2) .OrderBy <TestEntity>(c => c.Test6, SqlOrderType.Asc); return(command.ToDbCommand()); }
internal static void DatabaseNormalCreateSelectCommand() { SelectCommand command = DbHelper.FakeDb.CreateSelectCommand(_repository.TableName) .Querys("TestColumn1", "TestColumn2", "TestColumn5", "TestColumn8") .Query("TestColumn3", "TTTT") .Query(SqlAggregateFunction.Max, "TestColumn4", "MMMM") .Where(c => c.GreaterThanOrEqual("TestColumn2", 123) | (c.GreaterThan("TestColumn5", 1) & c.LessThan("TestColumn5", 10))) .GroupBy("TestColumn3") .InnerJoin("TestColumn2", "TestTable", "TestColumn2") .OrderBy("TestColumn6", SqlOrderType.Asc); DbCommand dbCommand = command.ToDbCommand(); }