public void TestDesignTimeDbContextFactory() { IDesignTimeDbContextFactory <FSContext> o = new DesignTimeDbContextFactory(); FSContext context = o.CreateDbContext(null); context.Database.EnsureCreated(); }
public FSItemsController(FSContext context) { _context = context; if (_context.FSItems.Count() == 0) { _context.FSItems.AddRange(staticdata); _context.SaveChanges(); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStatusCodePages(); app.UseStaticFiles(); app.UseMvc(routes => { String categorySegment = RoutingTemplateStringBuilder.AsParameter(RoutingConstants.Segment.Category); //"Page{page:int}"; String page = RoutingConstants.StaticText.Page; String pageSegment = page + RoutingTemplateStringBuilder.AsParameter(page + ":int"); String home = RoutingConstants.Controller.Home; string index = RoutingConstants.Action.Index; var homeIndexRoutDefaults = new { controller = home, action = index, page = 1 }; // Category and Page routes.MapRoute( name: null, template: categorySegment + RoutingConstants.Term.Seperator + pageSegment, defaults: new { controller = home, action = index } ); // Page only routes.MapRoute( name: null, template: pageSegment, defaults: homeIndexRoutDefaults ); // Category only routes.MapRoute( name: null, template: categorySegment, defaults: homeIndexRoutDefaults ); // Home / Index default routes.MapRoute( name: null, template: "", defaults: homeIndexRoutDefaults ); routes.MapRoute(name: null, template: "{controller}/{action}/{id?}"); }); FSContext context = app.ApplicationServices.GetRequiredService <FSContext>(); DbInitializer.Initialize(context); }
public HomeViewModel() { ShowPieChartCommand = new RelayCommand(ShowPieChart, CanExecute); ShowBarChartCommand = new RelayCommand(ShowBarChart, CanExecute); CanExecuteChangedCommand = new RelayCommand(CanExecuteChanged); _Context = new FSContext(); var questions = _Context.Questions.ToList().Select(q => new QuestionVM(q)); Questions = new ObservableCollection <QuestionVM>(questions); }
public void TestInitializer() { Debug.WriteLine("TestInitializer()"); var builder = new DbContextOptionsBuilder <FSContext>(); builder.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=FSWeb;Trusted_Connection=True;MultipleActiveResultSets=true"); DbContext = new FSContext(builder.Options); DbContext.Database.EnsureDeleted(); DbContext.Database.EnsureCreated(); DbInitializer.Initialize(DbContext); }
public UOW(FSContext context) { _context = context; }
public SqlEntityRepository(FSContext dbContext) { DbContext = dbContext; Entities = dbContext.Set <T>(); }
public UserRepository(FSContext context) { _context = context; }
public ProjectSphereRepository(FSContext context) : base(context) { }
public ProjectTypeRepositry(FSContext context) : base(context) { }
public CountryRepository(FSContext context) : base(context) { }
public ProjectRepository(FSContext fscontext) : base(fscontext) { }
public SphereRepositry(FSContext context) : base(context) { }
public ProjectRepository(FSContext fscontext) { _fscontext = fscontext; }
public DiscussionRepository(FSContext context) : base(context) { }
public SqlRepository(FSContext context, IMapper mapperParm) { dbContext = context; mapper = mapperParm; }
public SkillsRepository(FSContext context) : base(context) { }
public PersonRepository(FSContext context) : base(context) { }
public FSItemLogic(FSContext context, IReadOnlyRepository <FSItem> repository) : base(context, repository) { }
public UserRepository(FSContext context) : base(context) { }
public LiveChartDemoViewModel(QuestionVM SelectedQuestion, string ChartType) { _Context = new FSContext(); var answers = _Context.Answers .ToList() .Where(a => a.QuestionId == SelectedQuestion.Id) .Select(a => new AnswerVM(a)); Answers = new ObservableCollection <AnswerVM>(answers); var options = SelectedQuestion.Options.ToString(); var optionsArr = options.Split(';'); Options = new ObservableCollection <AnswerVM>(); foreach (string s in optionsArr) { Options.Add(new AnswerVM(new Answer { Content = s })); } if (ChartType == "Pie") { PieChart = new PieChart(); foreach (AnswerVM option in Options) { //Determine how often this answer was given int count = Answers.Where(a => a.Content == option.Content).Count(); if (count != 0) { PieChart.Series.Add(new PieSeries { Values = new ChartValues <int> { count }, DataLabels = true, LabelPoint = chartpoint => string.Format("Antw. {0}, {1}x ({2:p})", option.OptionIndex, chartpoint.Y, chartpoint.Participation) }); } } } else { BarChart = new CartesianChart(); BarChart.AxisY.Add(new Axis { Title = "Aantal keer gegeven", MinValue = 0, MaxValue = Options.Count, Separator = new Separator { Step = 1 } }); BarChart.AxisX.Add(new Axis { Title = "Opties", ShowLabels = false }); foreach (AnswerVM option in Options) { //Determine how often this answer was given int count = Answers.Where(a => a.Content == option.Content).Count(); if (count != 0) { BarChart.Series.Add(new ColumnSeries { Values = new ChartValues <int> { count }, DataLabels = true, LabelPoint = point => string.Format("{0}: {1}x", option.OptionIndex, point.Y) }); } } } }
public BaseRepository(FSContext context) { Context = context; }
public ProjectProductRepository(FSContext context) : base(context) { }