Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public DataLockEventCollector(IProviderEventService eventService, ILog logger, IDataConfiguration config)
 {
     _eventService = eventService;
     _logger       = logger;
     _config       = config;
     _isEnabled    = _config.DataLocksEnabled;
 }
Exemplo n.º 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();
        }
Exemplo n.º 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
        }
Exemplo n.º 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'.");
     }
 }
Exemplo n.º 9
0
 public LegalEntityCreatedEventHandler(
     IMediator mediator,
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
Exemplo n.º 10
0
 public AgreementSignedEventHandler(
     IMediator mediator,
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
 }
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 13
0
 public AccountEventHandler(
     IEventRepository eventRepository,
     IDataConfiguration configuration,
     IMediator mediator,
     ILog logger)
     : base(eventRepository, configuration, logger)
 {
     _mediator = mediator;
     _logger   = logger;
 }
Exemplo n.º 14
0
        public DataSession(IDataConfiguration dataConfiguration)
        {
            if (dataConfiguration == null)
            {
                throw new ArgumentNullException(nameof(dataConfiguration));
            }

            Connection         = dataConfiguration.CreateConnection();
            _logger            = dataConfiguration.Logger;
            _disposeConnection = true;
        }
Exemplo n.º 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>();
        }
Exemplo n.º 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());
        }
Exemplo n.º 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]);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 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));
     }
 }
Exemplo n.º 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");
        }
Exemplo n.º 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
        }
Exemplo n.º 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;
 }
Exemplo n.º 25
0
 protected EventApiHandler(IEventRepository eventRepository, IDataConfiguration configuration, ILog logger) : base(eventRepository, configuration, logger)
 {
 }
 public DistributedCacheFactory(IDataConfiguration dataConfiguration)
 {
     this.dataConfiguration = dataConfiguration;
 }
Exemplo n.º 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();
 }
Exemplo n.º 30
0
 public TransferEventCollector(IProviderEventService eventService, ILog logger, IDataConfiguration config)
     : base(eventService, logger)
 {
     _config = config;
 }