Esempio n. 1
0
        static void TestExpression2()
        {
            EntitySchemaManager.LoadEntity <SceneObject>();
            var view          = EntitySchemaManager.GetSchema <SceneObject>(true);
            var dbProvider    = new Framework.Data.MsSql.MsSqlConnectionProvider(1, "");
            var commandStruct = dbProvider.CreateCommand <SceneObject>(view.Name, DbCommandMode.Select);

            commandStruct.Columns.Add(SqlExpression.As(SqlExpression.Function("count", SqlExpression.Symbol("*")), "Count"));
            var fields = new List <long>()
            {
                4, 3
            };

            commandStruct.Where(p => (p.Function == null || fields.Contains(p.ID)) && !p.Deleted);
            commandStruct.OrderBy(p => p.ID);

            var commandText = commandStruct.CommandText;
        }