static async Task Main(String[] args)
        {
            //PerformanceCacheTest.RunTest(100);
            new PLNull(new PLNull_DbFixtureInitDb()).ApplyFilterGroupBy(0).GetAwaiter().GetResult();
            //new ProcedureTest().ScalarFunction_get().GetAwaiter().GetResult();
            //new PLNull_ManyColumns(new PLNull_ManyColumnsFixtureInitDb()).Filter(1).GetAwaiter().GetResult();

            InformationSchemaMapping informationSchemaMapping = GetMappings();
            ProviderSpecificSchema   providerSchema           = CreateSchemaSqlServer(true);

            EdmModel dynamicEdmModel;

            using (var metadataProvider = providerSchema.CreateMetadataProvider(informationSchemaMapping))
            {
                DynamicTypeDefinitionManager typeDefinitionManager = DynamicTypeDefinitionManager.Create(metadataProvider);
                var dataAdapter = new DynamicDataAdapter(typeDefinitionManager);
                dynamicEdmModel = dataAdapter.BuildEdmModel(metadataProvider);
            }
            String csdlSchema = TestHelper.GetCsdlSchema(dynamicEdmModel);

            var parser = new OeParser(new Uri("http://dummy"), dynamicEdmModel);
            var stream = new MemoryStream();
            await parser.ExecuteGetAsync(new Uri("http://dummy/Orders?$expand=Customer,Items&$orderby=Id"), OeRequestHeaders.JsonDefault, stream, CancellationToken.None);

            stream.Position = 0;
            String result = new StreamReader(stream).ReadToEnd();
        }
Exemple #2
0
        private static DynamicTypeDefinitionManager CreateTypeDefinitionManager(bool useRelationalNulls)
        {
            IEdmModel edmModel         = new OeEdmModelBuilder(new OrderDataAdapter(), new OeEdmModelMetadataProvider()).BuildEdmModel();
            var       metadataProvider = new EdmDynamicMetadataProvider(edmModel);

            return(DynamicTypeDefinitionManager.Create(DynamicDbContext.CreateOptions(useRelationalNulls), metadataProvider));
        }
Exemple #3
0
        static async Task Main()
        {
            //PerformanceCacheTest.RunTest(100);
            await new PLNull(new PLNull_DbFixtureInitDb()).OrderByColumnsMissingInSelect(0);
            //new PLNull_ManyColumns(new PLNull_ManyColumnsFixtureInitDb()).Filter(1).GetAwaiter().GetResult();

            IEdmModel edmModel         = new OeEdmModelBuilder(new OrderDataAdapter(), new OeEdmModelMetadataProvider()).BuildEdmModel();
            var       metadataProvider = new EdmDynamicMetadataProvider(edmModel);

            DbContextOptions options  = DynamicDbContext.CreateOptions(true);
            var typeDefinitionManager = DynamicTypeDefinitionManager.Create(options, metadataProvider);

            ////var dbContext = typeDefinitionManager.CreateDynamicDbContext();
            ////var orders = typeDefinitionManager.GetQueryable(dbContext, "Orders");
            ////var zzz = orders.Include("Items").Include("AltCustomer").Include("Customer").Include("ShippingAddresses").ToList();

            ////var orderItems = typeDefinitionManager.GetQueryable(dbContext, "OrderItems");
            ////var zzz2 = orderItems.Include("Order").ToList();

            ////dbContext = new DynamicDbContext(options, typeDefinitionManager);
            ////var zzz3 = new InternalDbSet<DynamicType01>(dbContext).ToList();

            var dataAdapter     = new DynamicDataAdapter(typeDefinitionManager);
            var dynamicEdmModel = dataAdapter.BuildEdmModel();

            String schema = TestHelper.GetCsdlSchema(dynamicEdmModel);

            var parser = new OeParser(new Uri("http://dummy"), dynamicEdmModel);
            var stream = new MemoryStream();
            //await parser.ExecuteGetAsync(new Uri("http://dummy/Orders?$expand=Customer,Items&$orderby=Id"), OeRequestHeaders.JsonDefault, stream, CancellationToken.None);
            await parser.ExecuteGetAsync(new Uri("http://dummy/Orders"), OeRequestHeaders.JsonDefault, stream, CancellationToken.None);

            stream.Position = 0;
            String result = new StreamReader(stream).ReadToEnd();
        }
        private static EdmModel CreateDynamicEdmModel(bool useRelationalNulls)
        {
            ProviderSpecificSchema providerSchema = DynamicDataContext.Program.CreateSchemaSqlServer(useRelationalNulls);
            //ProviderSpecificSchema providerSchema = DynamicDataContext.Program.CreateSchemaPostgreSql(useRelationalNulls);
            //ProviderSpecificSchema providerSchema = DynamicDataContext.Program.CreateSchemaMySql(useRelationalNulls);

            InformationSchemaSettings informationSchemaSettings = DynamicDataContext.Program.GetSettings();

            using (var metadataProvider = providerSchema.CreateMetadataProvider(informationSchemaSettings))
            {
                var typeDefinitionManager = DynamicTypeDefinitionManager.Create(metadataProvider);
                var dataAdapter           = new DynamicDataAdapter(typeDefinitionManager);
                return(dataAdapter.BuildEdmModel(metadataProvider));
            }
        }
        private static EdmModel CreateDynamicEdmModel(bool useRelationalNulls)
        {
            //DbContextOptions<DynamicDbContext> options = OrderContextOptions.Create<DynamicDbContext>(useRelationalNulls);
            //var informationSchema = new SqlServerSchema(options);
            DbContextOptions <DynamicDbContext> options = DynamicDataContext.Program.CreateOptionsPostgreSql(useRelationalNulls);
            var informationSchema = new PostgreSqlSchema(options);

            InformationSchemaMapping informationSchemaMapping = DynamicDataContext.Program.GetMappings();

            using (var metadataProvider = new DynamicMetadataProvider(informationSchema, informationSchemaMapping))
            {
                var typeDefinitionManager = DynamicTypeDefinitionManager.Create(metadataProvider);
                var dataAdapter           = new DynamicDataAdapter(typeDefinitionManager);
                return(dataAdapter.BuildEdmModel(metadataProvider));
            }
        }
Exemple #6
0
        static async Task Main()
        {
            //PerformanceCacheTest.RunTest(100);
            await new PLNull(new PLNull_DbFixtureInitDb()).ExpandExpandMany(0, false);
            //new ProcedureTest().TableFunction_get().GetAwaiter().GetResult();
            //new PLNull_ManyColumns(new PLNull_ManyColumnsFixtureInitDb()).Filter(1).GetAwaiter().GetResult();

            //IEdmModel edmModel = new OeEdmModelBuilder(new OrderDataAdapter(), new OeEdmModelMetadataProvider()).BuildEdmModel();
            //var metadataProvider = new EdmDynamicMetadataProvider(edmModel);
            InformationSchemaMapping informationSchemaMapping = GetMappings();
            //var informationSchema = new SqlServerSchema(CreateOptionsSqlServer(true));
            var informationSchema = new PostgreSqlSchema(CreateOptionsPostgreSql(true));

            EdmModel dynamicEdmModel;

            using (var metadataProvider = new DynamicMetadataProvider(informationSchema, informationSchemaMapping))
            {
                DynamicTypeDefinitionManager typeDefinitionManager = DynamicTypeDefinitionManager.Create(metadataProvider);
                var dataAdapter = new DynamicDataAdapter(typeDefinitionManager);
                dynamicEdmModel = dataAdapter.BuildEdmModel(metadataProvider);
            }
            String csdlSchema = TestHelper.GetCsdlSchema(dynamicEdmModel);

            //var dbContext = typeDefinitionManager.CreateDynamicDbContext();
            //var orders = typeDefinitionManager.GetQueryable(dbContext, "Orders");
            //var zzz = orders.Include("Items").Include("AltCustomer").Include("Customer").Include("ShippingAddresses").ToList();

            //var orderItems = typeDefinitionManager.GetQueryable(dbContext, "OrderItems");
            //var zzz2 = orderItems.Include("Order").ToList();

            //dbContext = new DynamicDbContext(options, typeDefinitionManager);
            //var zzz3 = new InternalDbSet<DynamicType01>(dbContext).ToList();

            var parser = new OeParser(new Uri("http://dummy"), dynamicEdmModel);
            var stream = new MemoryStream();
            //await parser.ExecuteGetAsync(new Uri("http://dummy/Orders?$expand=Customer,Items&$orderby=Id"), OeRequestHeaders.JsonDefault, stream, CancellationToken.None);
            await parser.ExecuteGetAsync(new Uri("http://dummy/Orders"), OeRequestHeaders.JsonDefault, stream, CancellationToken.None);

            stream.Position = 0;
            String result = new StreamReader(stream).ReadToEnd();
        }