Esempio n. 1
0
        /// <summary>
        /// Configures a Firestorm Data source for Entity Framework Core.
        /// </summary>
        public static IFirestormServicesBuilder AddEntityFramework <TDbContext>(this IFirestormServicesBuilder builder, Action <FirestormEntityOptions> configureAction)
            where TDbContext : DbContext
        {
            var options = new FirestormEntityOptions();

            configureAction(options);
            return(builder.AddEntityFramework <TDbContext>(options));
        }
 internal EntitiesContextFactory(IServiceProvider serviceProvider, FirestormEntityOptions options)
 {
     _serviceProvider = serviceProvider;
     _options         = options;
 }
Esempio n. 3
0
        /// <summary>
        /// Configures a Firestorm Data source for Entity Framework Core.
        /// </summary>
        public static IFirestormServicesBuilder AddEntityFramework <TDbContext>(this IFirestormServicesBuilder builder, FirestormEntityOptions options)
            where TDbContext : DbContext
        {
            builder.AddDataSource(sp =>
            {
                var requestProvider  = sp.GetRequestServiceProvider();
                var dbContextFactory = new EntitiesContextFactory <TDbContext>(requestProvider, options);
                return(new EFCoreDataSource <TDbContext>(dbContextFactory));
            });

            return(builder);
        }