public async Task <T> Create(T entity) { using TimeKeeprDbContext context = _contextFactory.CreateDbContext(); EntityEntry <T> createdResult = await context.Set <T>().AddAsync(entity); await context.SaveChangesAsync(); return(createdResult.Entity); }
protected override void OnStartup(StartupEventArgs e) { TimeKeeprDbContextFactory contextFactory = new TimeKeeprDbContextFactory(); using (var db = contextFactory.CreateDbContext()) { db.Database.MigrateAsync(); } //making sure the decimal character is either , or . depending on locale FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata( XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("da-DK"); Window window = new LoginView(); window.ResizeMode = ResizeMode.NoResize; window.ShowDialog(); InitializeComponent(); base.OnStartup(e); }