Exemplo n.º 1
0
 public ProjectManagement()
 {
     projectRepository = new RepositoryProject();
     accoutM           = new RepositoryAccount();
     taskManagement    = new TaskManagement();
     configSystenm     = new RepositoryConfig();
 }
Exemplo n.º 2
0
        public RepositoryImpl([NotNull] DbContext dbContext, [NotNull] IRepositoryConfig config)
        {
            _objectContext = (dbContext as IObjectContextAdapter).ObjectContext;
            _config        = config;

            _objectSet = _objectContext.CreateObjectSet <TEntity>();
        }
Exemplo n.º 3
0
 public BlobLeaseHelper(ILog log, IRepositoryConfig repositoryConfig, ValidateStorage validateStorage, CloudBlockBlobMd5Helper cloudBlockBlobMd5Helper, BlobRequestOptionsHelper blobRequestOptionsHelper)
     : base(log, validateStorage, cloudBlockBlobMd5Helper, blobRequestOptionsHelper)
 {
     _log = log;
     _log.Debug();
     _acquiredLeases  = new Dictionary <string, Lease>();
     ConnectionString = repositoryConfig.StorageAccountConnectionString;
 }
Exemplo n.º 4
0
        public SqlServerRepository(IEntitySerialiser serialiser, IRepositoryConfig config, IDatabase database,
                                   ISqlBuilder <T> sqlBuilder)
        {
            InitColumnMapping();

            this.database = database;
            Serialiser    = serialiser;
            Config        = config;

            this.sqlBuilder = sqlBuilder;
            sqlBuilder.Init(Config, IdentityFieldName, IndexedColumnMetadata);
            InitSerialiser();
        }
Exemplo n.º 5
0
        public void Init(IRepositoryConfig config, string identityFieldName,
                         Dictionary <string, Type> columnMetadata = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (identityFieldName == null)
            {
                throw new ArgumentNullException(nameof(identityFieldName));
            }

            this.config       = config;
            IdentityFieldName = identityFieldName;
            ColumnMetadata    = columnMetadata ?? new Dictionary <string, Type>();
        }
Exemplo n.º 6
0
 public RepositoryBase(ILog log, ValidateStorage validateStorage,
                       TableRequestOptionsHelper tableRequestOptionsHelper, IRepositoryConfig repositoryConfig)
 {
     // inspired by:
     // https://docs.particular.net/nservicebus/azure-storage-persistence/performance-tuning
     // http://blogs.msmvps.com/nunogodinho/2013/11/20/windows-azure-storage-performance-best-practices/
     // https://blogs.msdn.microsoft.com/windowsazurestorage/2010/06/25/nagles-algorithm-is-not-friendly-towards-small-requests/
     // https://alexandrebrisebois.wordpress.com/2013/03/24/why-are-webrequests-throttled-i-want-more-throughput/
     log.Debug();
     ServicePointManager.UseNagleAlgorithm      = false;
     ServicePointManager.Expect100Continue      = false;
     ServicePointManager.DefaultConnectionLimit = 1000;
     _validateStorage           = validateStorage;
     _tableRequestOptionsHelper = tableRequestOptionsHelper;
     Config = repositoryConfig;
 }
Exemplo n.º 7
0
        public RepositoryData(IRepositoryConfig repositoryConfig)
        {
            if (repositoryConfig == null) throw new ArgumentNullException("repositoryConfig");
            this.repositoryConfig = repositoryConfig;
            if (!string.IsNullOrWhiteSpace(repositoryConfig.PersistedDataPath))
            {
                this.IndexesCached = new Lazy<Cache<Type, IIndex>>(() =>
                {
                    var path = Path.Combine(this.repositoryConfig.PersistedDataPath, "Indexes");
                    if (!Directory.Exists(path)) return new Cache<Type, IIndex>(this.repositoryConfig.Indexes.ToDictionary(index => index.GetType(), index => index));
                    var cache = new Cache<Type, IIndex>();
                    Directory.EnumerateFiles(path)
                        .Each(fileName =>
                        {
                            using (var entityFileStream = File.OpenRead(fileName))
                            {
                                var indexContainer = JsonSerializer.DeserializeFromStream<IndexContainer>(entityFileStream);
                                cache.Fill(indexContainer.Type, indexContainer.Index);
                            }
                        });
                    return cache;
                });

                this.EntitiesCached = new Lazy<Cache<Type, List<dynamic>>>(() =>
                {
                    var path = Path.Combine(this.repositoryConfig.PersistedDataPath, "Entities");
                    if (!Directory.Exists(path)) return new Cache<Type, List<dynamic>>();
                    var cache = new Cache<Type, List<dynamic>>();
                    Directory.EnumerateFiles(path)
                        .Each(fileName =>
                        {
                            using (var entityFileStream = File.OpenRead(fileName))
                            {
                                var entityContainer = JsonSerializer.DeserializeFromStream<EntityContainer>(entityFileStream);
                                cache.Fill(entityContainer.Type, entityContainer.Entities);
                            }
                        });
                    return cache;
                });
            }
            else
            {
                this.IndexesCached = new Lazy<Cache<Type, IIndex>>(() => new Cache<Type, IIndex>(repositoryConfig.Indexes.ToDictionary(index => index.GetType(), index => index)));
                this.EntitiesCached = new Lazy<Cache<Type, List<dynamic>>>(() => new Cache<Type, List<dynamic>>());
            }
        }
Exemplo n.º 8
0
        public AppConfig()
        {
            _configuration = new ConfigurationBuilder()
                             .AddJsonFile("appsettings.json", optional: true)
                             .Build();

            _repositoryConfig = new RepositoryConfig
            {
                LocalRepositoryPath = _configuration["RepositoryConfig:LocalRepositoryPath"],
                RepositoryAddress   = _configuration["RepositoryConfig:RepositoryAddress"]
            };

            _databaseConfig = new DatabaseConfig
            {
                DefaultConnectionString = _configuration["DatabaseConfig:ConnectionString"],
                ConnectionString        = Environment.CurrentDirectory + $"\\LocalDatabase.db"
            };
        }
Exemplo n.º 9
0
 public AccountManagement()
 {
     accountRepository = new RepositoryAccount();
     configSystenm     = new RepositoryConfig();
 }
Exemplo n.º 10
0
 public AuthenticationService(IFactory factory, IRepositoryConfig config)
 {
     _factory = factory;
     _config = config;
 }
 public FlightRepository(IRepositoryConfig config)
 {
     _config = config;
 }
Exemplo n.º 12
0
 public UserRepository(IRepositoryConfig config)
 {
     _config = config;
 }
Exemplo n.º 13
0
 public UserRepository(IRepositoryConfig config)
 {
     this.config = config;
 }
 public MemberConfigForRep(IRepositoryConfig repConfig)
 {
     this.repConfig = repConfig;
 }
 public InMemoryRepository(IEntitySerialiser serialiser, IRepositoryConfig config)
 {
     Serialiser = serialiser;
     Config     = config;
     Store      = new Dictionary <object, object>();
 }
 public FileRepository(IEntitySerialiser serialiser, IRepositoryConfig config)
 {
     Serialiser = serialiser;
     Config     = config;
 }
 public void ConfigRepository(IRepositoryConfig repConfig)
 {
     config(new MemberConfigForRep(repConfig));
 }
Exemplo n.º 18
0
 public LessonRepository(IRepositoryConfig config)
 {
     _config = config;
 }