Beispiel #1
0
        private void InitServices()
        {
            if (_initializing)
            {
                throw new InvalidDataException("当前正在初始化");
            }

            try
            {
                _initializing = true;

                var optsBuilder = new DbContextOptionsBuilder();
                OnConfiguring(optsBuilder);
                var options = optsBuilder.Build();

                var entityMapper = EntityMapperFactory.Instance.GetEntityMapper(this);
                var sqlGenerater = new DefaultSqlGenerater(entityMapper, options.SqlAdapter);
                var dbCtxSvces   = new DbContextServices
                {
                    ConnectionString = options.ConnectionString,
                    SqlAdapter       = options.SqlAdapter,
                    EntityMapper     = entityMapper,
                    SqlGenerater     = sqlGenerater
                };
                _dbContextServices = dbCtxSvces;

                OnConfigured();
            }
            finally
            {
                _initializing = false;
            }
        }
Beispiel #2
0
        protected DataStoreSource([NotNull] DbContextServices services, [NotNull] DbContextService <IDbContextOptions> options)
        {
            Check.NotNull(services, "services");
            Check.NotNull(options, "options");

            _services = services;
            _options  = options;
        }
Beispiel #3
0
 public FakeDataStoreSource(DbContextServices services, DbContextService <IDbContextOptions> options)
     : base(services, options)
 {
 }
Beispiel #4
0
 public SqlServerDataStoreSource([NotNull] DbContextServices services, [NotNull] DbContextService <IDbContextOptions> options)
     : base(services, options)
 {
 }