public EntityFrameworkExternalDataSource(DbContext dbContext)
 {
     _dbContext = dbContext;
     SetOptionsForDbContext(_dbContext);
     _efManager = new EFManager(dbContext);
     _efManager.ReloadDbEntries();
 }
예제 #2
0
 public EntityFrameworkExternalDataSource(DbContext dbContext)
 {
     _dbContext = dbContext;
     SetOptionsForDbContext(_dbContext);
     _efManager = new EFManager(dbContext);
     _efManager.ReloadDbEntries();
 }
 public EntityFrameworkExternalDataSource(DbContext dbContext, Type[] typesToLoad)
 {
     _dbContext = dbContext;
     SetOptionsForDbContext(_dbContext);
     _initialLoadEntries = typesToLoad;
     _efManager = new EFManager(dbContext);
     _efManager.ReloadDbEntries();
 }
예제 #4
0
 public EntityFrameworkExternalDataSource(DbContext dbContext, Type[] typesToLoad)
 {
     _dbContext = dbContext;
     SetOptionsForDbContext(_dbContext);
     _initialLoadEntries = typesToLoad;
     _efManager          = new EFManager(dbContext);
     _efManager.ReloadDbEntries();
 }
예제 #5
0
        /// <summary>
        /// Initialize and configure the data source using given properties.
        /// Called when space is started.
        /// </summary>
        /// <param name="properties">Propeties to initialize by.</param>
        public override void Init(Dictionary <string, string> properties)
        {
            base.Init(properties);

            _enumeratorLoadFetchSize   = GetIntProperty("EnumeratorLoadFetchSize", _enumeratorLoadFetchSize);
            _initialLoadChunkSize      = GetIntProperty("InitialLoadChunkSize", _initialLoadChunkSize);
            _performOrderById          = GetBoolProperty("PerformOrderById", _performOrderById);
            _initialLoadThreadPoolSize = GetIntProperty("InitialLoadThreadPoolSize", _initialLoadThreadPoolSize);

            if (_dbContext == null)
            {
                string dbContextTypeName = GetProperty("EntityFrameworkContextFullTypeName");
                if (string.IsNullOrWhiteSpace(dbContextTypeName))
                {
                    throw new ArgumentException("Could not initialize DbContext instance because parameter 'EntityFrameworkContextFullTypeName' is null or whitespace.");
                }

                string entityFrameworkConnectionString = GetProperty("EntityFrameworkConnectionString");
                if (string.IsNullOrWhiteSpace(dbContextTypeName))
                {
                    throw new ArgumentException("Could not initialize DbContext instance because parameter 'EntityFrameworkConnectionString' is null or whitespace.");
                }

                var type = Type.GetType(dbContextTypeName);
                if (type == null)
                {
                    throw new ArgumentException("Could not resolve type by name. Type name must have following format: 'GigaSpaces.ProjectNamespace.StockSbaContextClassName, AssemblyName'");
                }

                _dbContext = (DbContext)Activator.CreateInstance(type, entityFrameworkConnectionString);
                SetOptionsForDbContext(_dbContext);
                _efManager = new EFManager(_dbContext);
                _efManager.ReloadDbEntries();
            }

            if (_initialLoadEntries == null)
            {
                _dbContext.GetValidationErrors();
                // TODO: Find a way to load these without so much investigation on usage.
                _initialLoadEntries = _efManager.DbEntries;
            }
        }
 internal EntityFrameworkExternalDataSource(DbContext dbContext, EFManager efManager)
 {
     _dbContext = dbContext;
     SetOptionsForDbContext(_dbContext);
     _efManager = efManager;
 }
        /// <summary>
        /// Initialize and configure the data source using given properties.
        /// Called when space is started.
        /// </summary>
        /// <param name="properties">Propeties to initialize by.</param>
        public override void Init(Dictionary<string, string> properties)
        {
            base.Init(properties);

            _enumeratorLoadFetchSize = GetIntProperty("EnumeratorLoadFetchSize", _enumeratorLoadFetchSize);
            _initialLoadChunkSize = GetIntProperty("InitialLoadChunkSize", _initialLoadChunkSize);
            _performOrderById = GetBoolProperty("PerformOrderById", _performOrderById);
            _initialLoadThreadPoolSize = GetIntProperty("InitialLoadThreadPoolSize", _initialLoadThreadPoolSize);

            if (_dbContext == null)
            {
                string dbContextTypeName = GetProperty("EntityFrameworkContextFullTypeName");
                if (string.IsNullOrWhiteSpace(dbContextTypeName))
                    throw new ArgumentException("Could not initialize DbContext instance because parameter 'EntityFrameworkContextFullTypeName' is null or whitespace.");

                string entityFrameworkConnectionString = GetProperty("EntityFrameworkConnectionString");
                if (string.IsNullOrWhiteSpace(dbContextTypeName))
                    throw new ArgumentException("Could not initialize DbContext instance because parameter 'EntityFrameworkConnectionString' is null or whitespace.");

                var type = Type.GetType(dbContextTypeName);
                if (type == null)
                    throw new ArgumentException("Could not resolve type by name. Type name must have following format: 'GigaSpaces.ProjectNamespace.StockSbaContextClassName, AssemblyName'");

                _dbContext = (DbContext)Activator.CreateInstance(type, entityFrameworkConnectionString);
                SetOptionsForDbContext(_dbContext);
                _efManager = new EFManager(_dbContext);
                _efManager.ReloadDbEntries();
            }

            if (_initialLoadEntries == null)
            {
                _dbContext.GetValidationErrors();
                // TODO: Find a way to load these without so much investigation on usage.
                _initialLoadEntries = _efManager.DbEntries;
            }
        }
예제 #8
0
 internal EntityFrameworkExternalDataSource(DbContext dbContext, EFManager efManager)
 {
     _dbContext = dbContext;
     SetOptionsForDbContext(_dbContext);
     _efManager = efManager;
 }