Ejemplo n.º 1
0
 public ExportFileCommandHandler(IBlobStorage blobStorage
                                 , IRecordsProvider provider
                                 )
 {
     this.blobStorage = blobStorage ?? throw new ArgumentNullException(nameof(blobStorage));
     this.provider    = provider ?? throw new ArgumentNullException(nameof(provider));
 }
Ejemplo n.º 2
0
 public Graph(IRecordsProvider recordsProvider, IFileStore fileStore)
 {
     RecordsProvider = recordsProvider;
     FileStore       = fileStore;
     EdgeTypes       = new List <IEdgeType>();
     NodeTypes       = new List <INodeType>();
     GraphId         = $"graph-{DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks:10}";
 }
        public bool RegisterProvider([NotNull] string name, [NotNull] IRecordsProvider provider)
        {
            name = name.ToLowerInvariant();

            if (providers.ContainsKey(name))
            {
                return(false);
            }

            providers.Add(name, provider);
            registrars.Add(name, Assembly.GetCallingAssembly());

            return(true);
        }
        public bool UnregisterProvider([NotNull] string name, [NotNull] IRecordsProvider provider)
        {
            name = name.ToLowerInvariant();

            if (registrars[name] != Assembly.GetCallingAssembly())
            {
                return(false);
            }

            if (providers.ContainsKey(name) && providers[name] != provider)
            {
                return(false);
            }

            providers.Remove(name);

            return(true);
        }
Ejemplo n.º 5
0
        public RecordsManager(IRecordsProvider recordsProvider)
        {
            this.recordsProvider = recordsProvider;

            this.prepositionTypesByLanguageId = new Lazy <ConcurrentDictionary <int, IEnumerable <PrepositionType> > >(() =>
            {
                var prepositionTypes = this.recordsProvider.GetAllPrepositionTypes()
                                       .GroupBy(k => k.LanguageId)
                                       .ToDictionary(k => k.Key, v => (IEnumerable <PrepositionType>)v);

                return(new ConcurrentDictionary <int, IEnumerable <PrepositionType> >(prepositionTypes));
            });

            this.recordTypesById = new Lazy <ConcurrentDictionary <int, RecordType> >(() =>
            {
                var recordTypes = this.recordsProvider.GetAllRecordTypes().ToDictionary(k => k.Id, v => v);
                return(new ConcurrentDictionary <int, RecordType>(recordTypes));
            });
        }
Ejemplo n.º 6
0
        public ExportTestFixture()
        {
            UserId = Guid.NewGuid();

            _harness             = new InMemoryTestHarness();
            _harness.TestTimeout = TimeSpan.FromSeconds(5);

            provider = new BlobStorageRecordsProvider(BlobStorage);

            _harness.OnConfigureBus += cfg =>
            {
                cfg.ReceiveEndpoint("test", e =>
                {
                    e.Consumer(() => new ExportFileCommandHandler(BlobStorage, provider));
                });
            };

            _harness.Start().Wait();
        }
Ejemplo n.º 7
0
 public RecordController(IRecordsProvider provider)
 {
     _provider = provider;
 }