Exemplo n.º 1
0
        public static void Initialize(this IApplicationBuilder builder)
        {
            var provider     = builder.ApplicationServices;
            var scopeFactory = provider.GetRequiredService <IServiceScopeFactory>();

            using (var scope = scopeFactory.CreateScope())
            {
                using (HopeLineDbContext context = scope.ServiceProvider.GetRequiredService <HopeLineDbContext>())
                {
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Injecting db contexts
 /// </summary>
 /// <param name="hopeLineDb"></param>
 public Repository(HopeLineDbContext hopeLineDb)
 {
     _hopeLineDb = hopeLineDb;
     _entities   = _hopeLineDb.Set <T>();
 }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="hopeLineDb"></param>
 public UserRepository(HopeLineDbContext hopeLineDb)
 {
     _hopeLineDb = hopeLineDb;
     _entities   = _hopeLineDb.Set <HopeLineUser>();
 }