Beispiel #1
0
        public ModelNavigator(LabSystemsContextFactory contextFactory)
        {
            // Not great, I know. Think of a cleaner way...
            string fullType = contextFactory.CreateDbContext().LabSystems.EntityType.Name;

            SelectedModelType = fullType.Substring(fullType.LastIndexOf('.') + 1);
        }
Beispiel #2
0
        public async Task <T> Create(T entity)
        {
            using (LabSystemsContext context = _contextFactory.CreateDbContext())
            {
                EntityEntry <T> createdResult = await context.Set <T>().AddAsync(entity);

                await context.SaveChangesAsync();

                return(createdResult.Entity);
            }
        }