예제 #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>())
                {
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Injecting db contexts
 /// </summary>
 /// <param name="hopeLineDb"></param>
 public Repository(HopeLineDbContext hopeLineDb)
 {
     _hopeLineDb = hopeLineDb;
     _entities   = _hopeLineDb.Set <T>();
 }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="hopeLineDb"></param>
 public UserRepository(HopeLineDbContext hopeLineDb)
 {
     _hopeLineDb = hopeLineDb;
     _entities   = _hopeLineDb.Set <HopeLineUser>();
 }