コード例 #1
0
        public static void EnsureSeedDataForContext(this TaskInfoContext context)
        {
            if (context.Tasks.Any())
            {
                return;
            }

            var tasks = new List <Task>()
            {
                new Task
                {
                    Name            = "Esystem Task",
                    Description     = "Runs in email user to send emails",
                    RelatedProjects = new List <RelatedProject>
                    {
                        new RelatedProject
                        {
                            Name        = "Live System",
                            Description = "This is the project that all the buttons are added"
                        },

                        new RelatedProject
                        {
                            Name        = "Terminal Server",
                            Description = "This is our old server that had email task in it"
                        }
                    }
                },

                new Task
                {
                    Name            = "Sync Task",
                    Description     = "Sync Access database to SQL database",
                    RelatedProjects = new List <RelatedProject>
                    {
                        new RelatedProject
                        {
                            Name        = "Developer App",
                            Description = "This is the app runs on developer pc"
                        },

                        new RelatedProject
                        {
                            Name        = "RDP System",
                            Description = "App that runs on developer RDP system"
                        },

                        new RelatedProject
                        {
                            Name        = "Managers Project",
                            Description = "The is the project that is special for IT manager"
                        }
                    }
                },

                new Task
                {
                    Name            = "Amazon Task",
                    Description     = "Generates reports for our Amazon inventory",
                    RelatedProjects = new List <RelatedProject>
                    {
                        new RelatedProject
                        {
                            Name        = "Amazon Server",
                            Description = "This is the only server that runs the Amazon application"
                        }
                    }
                }
            };

            context.Tasks.AddRange(tasks);
            context.SaveChanges();
        }
コード例 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, TaskInfoContext taskInfoContext)
        {
            loggerFactory.AddConsole();

            loggerFactory.AddDebug();

            //loggerFactory.AddProvider(new NLogLoggerProvider());
            loggerFactory.AddNLog();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }

            taskInfoContext.EnsureSeedDataForContext();

            app.UseStatusCodePages();

            app.UseMvc();

            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Entities.Task, Models.TaskWithoutRelatedProjectsDto>
            });
            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }
コード例 #3
0
 public DummyController(TaskInfoContext ctx)
 {
     _ctx = ctx;
 }
コード例 #4
0
 public TaskInfoRepository(TaskInfoContext context)
 {
     _context = context;
 }