Пример #1
0
        public SampleData(IDataConfiguration config)
        {
            _config = config;

            List <ShortURL> urls = new List <ShortURL>()
            {
                new ShortURL()
                {
                    Key = "goog", Url = "https://google.com"
                },
                new ShortURL()
                {
                    Key = "me", Url = "https://developingux.com"
                },
                new ShortURL()
                {
                    Key = "index", Url = "https://linkedin.com"
                },
                new ShortURL()
                {
                    Key = "li", Url = "https://linkedin.com/in/calebjenkins/"
                },
            };

            foreach (var url in urls)
            {
                _urls.Add(url.Key, url);
            }
        }
Пример #2
0
        public IEnumerable <DataMergeOutputRow> Process(BatchJob batchJob, IDataConfiguration dataConfiguration)
        {
            if (batchJob == null)
            {
                throw new ArgumentNullException(nameof(batchJob));
            }
            if (dataConfiguration == null)
            {
                throw new ArgumentNullException(nameof(dataConfiguration));
            }

            Logger.Info()
            .Message("Running batch job with file: '{0}'", batchJob.WorkingFile)
            .Write();

            // reset all cache
            _factory.Reset();

            // load file into DataTable
            var dataTable = LoadData(batchJob);

            // create DataMergeDefinition
            var mergeDefinition = CreateDefinition(batchJob);

            // run DataMerge
            var result = Merge(mergeDefinition, dataTable, dataConfiguration);

            return(result);
        }
Пример #3
0
 public DataLockEventCollector(IProviderEventService eventService, ILog logger, IDataConfiguration config)
 {
     _eventService = eventService;
     _logger       = logger;
     _config       = config;
     _isEnabled    = _config.DataLocksEnabled;
 }
Пример #4
0
        private void ProcessData(IDataConfiguration config, IRelationalObject data)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            var sender = senderFactory.GetDataSender(config);

            sender.SendData(data);

            if (data.Children == null || !data.Children.Any())
            {
                return;
            }

            foreach (var relationship in data.Children)
            {
                if (!config.Relationships.ContainsKey(relationship.RelationshipName))
                {
                    throw new InvalidOperationException($"Cannot find relationship with name {relationship.RelationshipName}");
                }

                var relationshipConfig = config.Relationships[relationship.RelationshipName];
                ProcessData(relationshipConfig, relationship);
            }
        }
        protected override void Arrange()
        {
            base.Arrange();
            Builder = new ConfigurationSourceBuilder();

            DataConfig = Builder.ConfigureData();
        }
Пример #6
0
        /// <summary>
        /// The register unit of work.
        /// </summary>
        /// <param name="configuration">
        /// The configuration.
        /// </param>
        /// <param name="container">
        /// The container.
        /// </param>
        /// <param name="serviceProvider">
        /// The service provider.
        /// </param>
        /// <exception cref="Exception">
        /// </exception>
        public void RegisterUnitOfWork(
            IDataConfiguration configuration,
            IContainer container,
            IServiceProvider serviceProvider = null)
        {
            if (configuration == null || configuration.ConnectionStrings == null ||
                !configuration.ConnectionStrings.ContainsKey("RepoTestNHibOracle"))
            {
                throw new Exception("Invalid configuration specified in database manager");
            }

            var nHibConfig = OracleClientConfiguration.Oracle10.ConnectionString(configuration.ConnectionStrings["RepoTestNHibOracle"]);

            Configuration = Fluently.Configure().Database(nHibConfig)
                            .Mappings(o => o.FluentMappings.AddFromAssembly(System.Reflection.Assembly.GetExecutingAssembly()));
            Factory = Configuration.BuildSessionFactory();

            container.Configure(
                config =>
            {
                config.For <IUnitOfWork>().LifecycleIs(Lifecycles.Transient).Use <OracleFullContext>()
                .Ctor <ISessionFactory>("factory").Is(Factory);
            });

            // End
        }
Пример #7
0
 public ApprenticeshipEventHandler(
     IMediator mediator, IEventRepository eventRepository,
     IDataConfiguration configuration, ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
 public ContentDbContext(IDataConfiguration dataConfiguration)
 {
     _dataConfiguration = dataConfiguration;
     if (dataConfiguration?.ConnectionString == null)
     {
         throw new Exception("appsettings.json must contain a 'data' section with a property 'ConnectionString'.");
     }
 }
Пример #9
0
 public LegalEntityCreatedEventHandler(
     IMediator mediator,
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
Пример #10
0
 public AgreementSignedEventHandler(
     IMediator mediator,
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
 public PayeSchemeRemovedEventHandler(
     IMediator mediator,
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
 public EmploymentCheckCompleteEventHandler(
     IMediator mediator,
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
Пример #13
0
 public AccountEventHandler(
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     IMediator mediator,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
     _logger   = logger;
 }
Пример #14
0
        public DataSession(IDataConfiguration dataConfiguration)
        {
            if (dataConfiguration == null)
            {
                throw new ArgumentNullException(nameof(dataConfiguration));
            }

            Connection         = dataConfiguration.CreateConnection();
            _logger            = dataConfiguration.Logger;
            _disposeConnection = true;
        }
Пример #15
0
        public static void AddDatabase(this IServiceCollection services, IDataConfiguration configuration)
        {
            services.AddSingleton(configuration);

            services.AddDbContext <SpisumContext>(options =>
            {
                options.UseNpgsql(configuration.Connection);
                //options.EnableDetailedErrors();
            });

            services.AddScoped <ITransactionHistoryRepository, TransactionHistoryRepository>();
            services.AddScoped <ISystemLoginRepository, SystemLoginRepository>();
        }
Пример #16
0
        public FileContextProvider(
            XmlSchemaSet xmlSchemaSet,
            IDataConfiguration dataConfiguration,
            IXsdConfiguration xsdConfiguration,
            IBulkLoadClientResult bulkLoadClientResult)
        {
            _xmlSchemaSet         = xmlSchemaSet;
            _dataConfiguration    = dataConfiguration;
            _xsdConfiguration     = xsdConfiguration;
            _bulkLoadClientResult = bulkLoadClientResult;

            _fileContexts = new Lazy <List <FileContext> >(() => CreateFileContexts().Where(x => x.IsValid).ToList());
        }
Пример #17
0
        public IDataSender GetDataSender(IDataConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (!senders.ContainsKey(configuration))
            {
                senders.Add(configuration, CreateDataSender(configuration));
            }

            return(senders[configuration]);
        }
Пример #18
0
        public void ProcessData(IDataConfiguration config, JObject jsonData)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (jsonData == null)
            {
                throw new ArgumentNullException(nameof(jsonData));
            }

            ProcessData(
                config,
                objectReader.ReadJson(jsonData));
        }
Пример #19
0
        public XmlIoFactory(IDataConfiguration configuration)
        {
            _destinationPath = Path.Combine(configuration.Folder, "Output");
            _files           = new List <string>(Directory.GetFiles(configuration.Folder, "*.xml"));

            var dirInfo = Directory.CreateDirectory(_destinationPath);

            foreach (var fileInfo in dirInfo.EnumerateFiles())
            {
                if (_files.Any(
                        f =>
                        string.Compare(Path.GetFileName(f), fileInfo.Name, StringComparison.CurrentCultureIgnoreCase) == 0))
                {
                    fileInfo.Delete();
                }
            }
        }
Пример #20
0
 public SqlDbContext(IDataProfiler profiler, IDataConfiguration config, IDataLocalizer localizer, ITenantManager tenantManager = null)
 {
     _profiler      = profiler;
     _config        = config;
     _localizer     = localizer;
     _tenantManager = tenantManager;
     if (_profiler == null)
     {
         throw new ArgumentNullException(nameof(profiler));
     }
     if (_config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     if (_localizer == null)
     {
         throw new ArgumentNullException(nameof(localizer));
     }
 }
Пример #21
0
        private IDataSender CreateDataSender(IDataConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (configuration.File != null)
            {
                return(new FileDataSender(serialiser, configuration.File, streamFactory));
            }

            if (configuration.Process != null)
            {
                return(new ProcessDataSender(serialiser, configuration.Process));
            }

            throw new InvalidOperationException("No output configured, provide either 'file' or 'process' in the config file or use the `--out-to-files` switch to output data to individual files");
        }
Пример #22
0
        /// <summary>
        /// The register unit of work.
        /// </summary>
        /// <param name="configuration">
        /// The configuration.
        /// </param>
        /// <param name="container">
        /// The container.
        /// </param>
        /// <param name="serviceProvider">
        /// The service provider.
        /// </param>
        /// <exception cref="Exception">
        /// </exception>
        public void RegisterUnitOfWork(
            IDataConfiguration configuration,
            IContainer container,
            IServiceProvider serviceProvider = null)
        {
            if (configuration == null || configuration.ConnectionStrings == null ||
                !configuration.ConnectionStrings.ContainsKey("RepoTestEFMySql"))
            {
                throw new Exception("Invalid configuration specified in database manager");
            }

            container.Configure(
                config =>
            {
                config.For <IUnitOfWork>().LifecycleIs(Lifecycles.Transient).Use <MySqlFullContext>()
                .Ctor <string>("connectionString").Is(configuration.ConnectionStrings["RepoTestEFMySql"]);
            });

            // End
        }
Пример #23
0
        /// <summary>
        /// The build.
        /// </summary>
        /// <param name="services">
        /// The services.
        /// </param>
        /// <param name="configuration">
        /// The configuration.
        /// </param>
        /// <param name="hostingEnvironment">
        /// The hosting environment.
        /// </param>
        /// <returns>
        /// The <see cref="IServiceProvider"/>.
        /// </returns>
        public static IServiceProvider Build(
            this IServiceCollection services,
            IConfiguration configuration,
            IHostingEnvironment hostingEnvironment,
            string scanFolder,
            string searchAssemblies
            )
        {
            var container = StructureMapRegistration.CreateAndConfigure(configuration, services, scanFolder, searchAssemblies);

            services.AddSingleton(configuration);

            // Setup identity
            //var identityManager = container.TryGetInstance<IIdentityManager>();
            //identityManager?.AddCustomizedIdentity(services, configuration, null);

            container.Configure(config => config.Populate(services));

            //IUnitOfWork unitOfWork = container.GetInstance<IDatabaseManager>().BeginUnitOfWork(
            //    container.GetInstance<IDataConfiguration>());

            //For<IDataConfiguration>().Use<DataConfiguration>
            //    .Ctor<string>("connectionString").Is(dataConfiguration);



            //container.Configure(
            //    config =>
            //        {
            //            config.For<IUnitOfWork>().LifecycleIs(Lifecycles.Transient).Use(() => unitOfWork);
            //        });

            IDatabaseManager   databaseManager   = container.GetInstance <IDatabaseManager>();
            IDataConfiguration dataConfiguration = container.GetInstance <IDataConfiguration>();

            databaseManager.RegisterUnitOfWork(dataConfiguration, container);

            return(container.GetInstance <IServiceProvider>());
        }
 public DataContext(IDataConfiguration config)
 {
     _config = config;
 }
Пример #25
0
 protected EventApiHandler(IEventRepository eventRepository, IDataConfiguration configuration, ILog logger) : base(eventRepository, configuration, logger)
 {
 }
 public DistributedCacheFactory(IDataConfiguration dataConfiguration)
 {
     this.dataConfiguration = dataConfiguration;
 }
Пример #27
0
 protected PeriodEndEventHandler(IMediator mediator, IEventRepository eventRepository, IDataConfiguration configuration, ILog logger) : base(eventRepository, configuration, logger)
 {
     Mediator = mediator;
 }
 public LevyDeclarationUpdatedEventHandler(IMediator mediator, IEventRepository eventRepository, IDataConfiguration configuration, ILog logger) : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
 public override void Initialize()
 {
     builder            = new ConfigurationSourceBuilder();
     configurationStart = builder.ConfigureData();
 }
Пример #30
0
 public TransferEventCollector(IProviderEventService eventService, ILog logger, IDataConfiguration config)
     : base(eventService, logger)
 {
     _config = config;
 }