public ReportRepository()
 {
     dbContext = new ReportsDbContext();
 }
Ejemplo n.º 2
0
 public MessagesController(ILogger <MessagesController> logger, ReportsDbContext context)
 {
     _logger    = logger;
     _dbContext = context;
 }
 public CustomerReportRepository()
 {
     dbContext = new ReportsDbContext();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Force EF to generate the Model Metadata.
        /// </summary>
        public static void GenerateViews(string viewCachePath, ILog log = null)
        {
            // Use the provided ILog instance or create our own.
            log = log ?? LogProvider.Get(typeof(ContextPreloader));

            log.Debug("View Cache Directory set to: {0}", viewCachePath);
            var admin = Task.Factory.StartNew(() =>
            {
                var timer = Stopwatch.StartNew();
                var ctx   = new AdministrationDbContext();
                InteractiveViews.SetViewCacheFactory(ctx, new FileViewCacheFactory(String.Format("{0}\\AdministrationDbContext.xml", viewCachePath)));
                //InteractiveViews.SetViewCacheFactory(ctx, new SqlServerViewCacheFactory(ctx.Database.Connection.ConnectionString));
                ctx.Set <Agency>().ToString();
                timer.Stop();
                log.Debug("AdministrationDbContext Initialized in {0}ms", timer.ElapsedMilliseconds);
            });

            var reports = Task.Factory.StartNew(() =>
            {
                var timer = Stopwatch.StartNew();
                var ctx   = new ReportsDbContext();
                InteractiveViews.SetViewCacheFactory(ctx, new FileViewCacheFactory(String.Format("{0}\\ReportsDbContext.xml", viewCachePath)));
                //InteractiveViews.SetViewCacheFactory(ctx, new SqlServerViewCacheFactory(ctx.Database.Connection.ConnectionString));
                ctx.Set <Report>().ToString();
                timer.Stop();
                log.Debug("ReportsDbContext Initialized in {0}ms", timer.ElapsedMilliseconds);
            });

            var summaries = Task.Factory.StartNew(() =>
            {
                var timer = Stopwatch.StartNew();
                var ctx   = new SummariesDbContext();
                InteractiveViews.SetViewCacheFactory(ctx, new FileViewCacheFactory(String.Format("{0}\\SummariesDbContext.xml", viewCachePath)));
                //InteractiveViews.SetViewCacheFactory(ctx, new SqlServerViewCacheFactory(ctx.Database.Connection.ConnectionString));
                ctx.Set <Summary>().ToString();
                timer.Stop();
                log.Debug("SummariesDbContext Initialized in {0}ms", timer.ElapsedMilliseconds);
            });

            var recentInfo = Task.Factory.StartNew(() =>
            {
                var timer = Stopwatch.StartNew();
                var ctx   = new RecentInfoDbContext();
                InteractiveViews.SetViewCacheFactory(ctx, new FileViewCacheFactory(String.Format("{0}\\RecentInfoDbContext.xml", viewCachePath)));
                //InteractiveViews.SetViewCacheFactory(ctx, new SqlServerViewCacheFactory(ctx.Database.Connection.ConnectionString));
                ctx.Set <RecentEvent>().ToString();
                timer.Stop();
                log.Debug("RecentInfoDbContext Initialized in {0}ms", timer.ElapsedMilliseconds);
            });

            var messaging = Task.Factory.StartNew(() =>
            {
                var timer = Stopwatch.StartNew();
                var ctx   = new MessagingDbContext();
                InteractiveViews.SetViewCacheFactory(ctx, new FileViewCacheFactory(String.Format("{0}\\MessagingDbContext.xml", viewCachePath)));
                //InteractiveViews.SetViewCacheFactory(ctx, new SqlServerViewCacheFactory(ctx.Database.Connection.ConnectionString));
                ctx.Set <MessageLog>().ToString();
                timer.Stop();
                log.Debug("MessagingDbContext Initialized in {0}ms", timer.ElapsedMilliseconds);
            });

            var audit = Task.Factory.StartNew(() =>
            {
                var timer = Stopwatch.StartNew();
                var ctx   = new AuditDbContext();
                InteractiveViews.SetViewCacheFactory(ctx, new FileViewCacheFactory(String.Format("{0}\\AuditDbContext.xml", viewCachePath)));
                //InteractiveViews.SetViewCacheFactory(ctx, new SqlServerViewCacheFactory(ctx.Database.Connection.ConnectionString));
                ctx.AuditEntities.ToString();
                timer.Stop();
                log.Debug("AuditDbContext Initialized in {0}ms", timer.ElapsedMilliseconds);
            });

            Task.WaitAll(admin, reports, summaries, recentInfo, messaging, audit);
        }
Ejemplo n.º 5
0
 public ReportsController(ILogger <ReportsController> logger, ReportsDbContext context)
 {
     _logger    = logger;
     _dbContext = context;
 }