Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            var dataAdapter = new OrderDataAdapter(true, true);

            app.UseOdataToEntityMiddleware <PageMiddleware>("/api", dataAdapter.BuildEdmModelFromEfCoreModel());
            app.UseMvcWithDefaultRoute();
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var dataAdapter = new OrderDataAdapter(true, true);

            services.AddOdataToEntityMvc(dataAdapter.BuildEdmModelFromEfCoreModel());

            services.AddLogging(loggingBuilder =>
            {
                loggingBuilder.AddConsole();
                loggingBuilder.AddDebug();
                loggingBuilder.AddConfiguration(Configuration.GetSection("Logging"));
            });
        }
Exemple #3
0
        public static void RunTest(int testCount)
        {
            SelectTestDefinition[] testDefinitions = SelectTestDefinition.GetSelectTestDefinitions();

            //warming-up
            var dataAdapter = new OrderDataAdapter(false, false);
            var dbContext   = (DbContext)dataAdapter.CreateDataContext();

            foreach (SelectTestDefinition testDefinition in testDefinitions)
            {
                testDefinition.ExecutorDb(dataAdapter, dbContext);
            }
            dataAdapter.CloseDataContext(dbContext);

            PerformanceCacheOeTest(testDefinitions, testCount, true);
            PerformanceCacheOeTest(testDefinitions, testCount, false);
            PerformanceCacheDbTest(testDefinitions, testCount);
        }
Exemple #4
0
        private static void PerformanceCacheDbTest(SelectTestDefinition[] testDefinitions, int testCount)
        {
            var pool        = new DbContextPool <OrderContext>(OrderContextOptions.Create(true));
            var dataAdapter = new OrderDataAdapter(false, false);

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            var stopWatch = new Stopwatch();

            stopWatch.Start();
            for (int i = 0; i < testCount; i++)
            {
                foreach (SelectTestDefinition testDefinition in testDefinitions)
                {
                    var dbContext = (OrderContext)pool.Rent();
                    testDefinition.ExecutorDb(dataAdapter, dbContext);
                    pool.Return(dbContext);
                }
            }
            stopWatch.Stop();
            Console.WriteLine("Entity Framework " + stopWatch.Elapsed);
        }
Exemple #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            var dataAdapter = new OrderDataAdapter(true, true);

            app.UseOdataToEntityMiddleware <OePageMiddleware>("/api", dataAdapter.BuildEdmModelFromEfCoreModel());
        }