示例#1
0
        private static void Clear()
        {
            var contentService          = new ContentApiService(Global.ConnectionString, 1);
            var baseContentExists       = contentService.Exists(BaseContentId);
            var dictionaryContentExists = contentService.Exists(DictionaryContentId);
            var fieldService            = new FieldApiService(Global.ConnectionString, 1);

            if (dictionaryContentExists)
            {
                InitDictionaryContentFields();
                var dictionaryIds = Global.GetIds(DbConnector, DictionaryContentId);
                ArticleService.Delete(DictionaryContentId, dictionaryIds);
            }

            if (baseContentExists)
            {
                InitBaseContentFields();
                InitExtensions();

                var baseIds = Global.GetIds(DbConnector, BaseContentId);
                ArticleService.Delete(BaseContentId, baseIds);
                contentService.Delete(Ex11ContentId);
                contentService.Delete(Ex12ContentId);
                contentService.Delete(Ex21ContentId);
                contentService.Delete(Ex22ContentId);
            }

            if (dictionaryContentExists)
            {
                fieldService.Delete(DictionaryFieldMtMBackwardId);
                fieldService.Delete(DictionaryFieldMtOBackwardId);
            }

            if (baseContentExists)
            {
                fieldService.Delete(BaseFieldMtMId);
                fieldService.Delete(BaseFieldOtMId);
            }

            if (dictionaryContentExists)
            {
                contentService.Delete(DictionaryContentId);
            }

            if (baseContentExists)
            {
                contentService.Delete(BaseContentId);
            }
        }
示例#2
0
        public JsonProductService(
            IConnectionProvider connectionProvider,
            ILogger logger,
            ContentService contentService,
            FieldService fieldService,
            VirtualFieldContextService virtualFieldContextService,
            IRegionTagReplaceService regionTagReplaceService,
            IOptions<LoaderProperties> loaderProperties,
            IHttpClientFactory factory            
            )
        {
            _logger = logger;
            _contentService = contentService;
            _fieldService = fieldService;

            var customer = connectionProvider.GetCustomer();
            _dbConnector = new DBConnector(customer.ConnectionString, customer.DatabaseType);

            _virtualFieldContextService = virtualFieldContextService;
            _regionTagReplaceService = regionTagReplaceService;
            _loaderProperties = loaderProperties.Value;
            _factory = factory;
        }