Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var config = new CassettesConfig();

            Configuration.Bind("CassettesConfig", config);
            services.AddSingleton(config);
            var cassettesFogsLoadService = new CassettesFogsLoadService(config);

            services.AddSingleton <CassettesFogsLoadService>(cassettesFogsLoadService);
            var tripleStoreBuilder = new TripleRecordStoreBuilder(config, cassettesFogsLoadService);

            services.AddSingleton(tripleStoreBuilder);

            services.AddSingleton(tripleStoreBuilder.Store);
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new TripleStoreProfile(tripleStoreBuilder.Store));
            });

            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);
            services.AddScoped <IRDFDataService, RDFDataService>();
            services.AddControllers();
            services.AddSingleton <CassettesUpdateSerevice>();
        }
Beispiel #2
0
        private bool _firsTime  = true; // Отмечает (вычисляет) ситуацию, когда базу данных обязательно нужно строить.



        public TripleRecordStoreBuilder(CassettesConfig config,
                                        CassettesFogsLoadService cassettesFogsLoadService)
        {
            // Подключение к базе данных, если задано
            string databaseConnectionString = config.Database?.ConnectionString;

            if (databaseConnectionString == null)
            {
                return;
            }
            Init(databaseConnectionString);
            if (config.Database.ToLoad)
            {
                //adapter.LoadFromCassettesExpress(fogs.Select(fo => fo.pth),
                //    null, null);
                FillDb(cassettesFogsLoadService.Fogs);
            }

            // Логфайл элементов Put()
        }