示例#1
0
        /// <summary>
        /// Creates a new instance of the <see cref="ModelsProvider"/> class.
        /// </summary>
        /// <param name="blobContainerProvider">A blob container provider</param>
        /// <param name="documentStoreProvider">A user history document store provider</param>
        /// <param name="trainedModelsLocalRootPath">A local folder to store trained model files</param>
        internal ModelsProvider(IBlobContainerProvider blobContainerProvider,
                                IDocumentStoreProvider documentStoreProvider,
                                string trainedModelsLocalRootPath)
        {
            if (blobContainerProvider == null)
            {
                throw new ArgumentNullException(nameof(blobContainerProvider));
            }

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

            if (string.IsNullOrWhiteSpace(trainedModelsLocalRootPath))
            {
                throw new ArgumentNullException(nameof(trainedModelsLocalRootPath));
            }

            _blobContainerProvider = blobContainerProvider;

            _documentStoreProvider = documentStoreProvider;

            // get the models container that stores trained models
            _modelsContainer = _blobContainerProvider.GetBlobContainer(ModelsBlobContainerName, true);

            // create the local directory if not exists
            _trainedModelsLocalRootPath = trainedModelsLocalRootPath;
            Directory.CreateDirectory(_trainedModelsLocalRootPath);
        }
示例#2
0
        /// <summary>
        /// Stores a <see cref="DbFeature" /> with the provided parameters to the database.
        /// </summary>
        /// <param name="documentStoreProvider">An <see cref="IDocumentStoreProvider" /> used to store the data.</param>
        /// <param name="product">Name of the product containing the feature.</param>
        /// <param name="group">Name of the group containing the feature.</param>
        /// <param name="title">Title of the feature.</param>
        /// <param name="version">Version of the feature.</param>
        /// <param name="tags">Optional additional tags for the feature.</param>
        /// <returns>The <see cref="DbFeature" /> instance that was just persisted.</returns>
        public static Task <DbFeature> StoreDbFeatureAsync(this IDocumentStoreProvider documentStoreProvider, string product, string group, string title, string version, params string[] tags)
        {
            var feature = GenerateFeature(title, tags);

            var featureManager = new FeatureManager(documentStoreProvider, Substitute.For <ILogger <FeatureManager> >());

            return(featureManager.InsertOrUpdateFeatureAsync(feature, product, group, version));
        }
示例#3
0
 public AugurkController(ICustomizationManager customizationManager,
                         IConfigurationManager configurationManager,
                         IFeatureManager featureManager,
                         IExpirationManager expirationManager,
                         IDocumentStoreProvider storeProvider)
 {
     _customizationManager = customizationManager ?? throw new ArgumentNullException(nameof(customizationManager));
     _configurationManager = configurationManager ?? throw new ArgumentNullException(nameof(configurationManager));
     _featureManager       = featureManager ?? throw new ArgumentNullException(nameof(featureManager));
     _expirationManager    = expirationManager ?? throw new ArgumentNullException(nameof(expirationManager));
     _documentStore        = storeProvider?.Store ?? throw new ArgumentNullException(nameof(storeProvider));
 }
示例#4
0
 public MigrationManager(IDocumentStoreProvider storeProvider, ILogger <MigrationManager> logger)
 {
     _storeProvider = storeProvider ?? throw new ArgumentNullException(nameof(storeProvider));
     _logger        = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        private static ModelsProvider CreateModelProvider(IBlobContainerProvider blobContainerProvider, IDocumentStoreProvider documentStoreProvider = null)
        {
            var tempFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                          Path.GetFileNameWithoutExtension(Path.GetTempFileName()));

            if (documentStoreProvider == null)
            {
                var emptyUserHistoryStore = Substitute.For <IDocumentStore>();
                emptyUserHistoryStore.GetDocument(Arg.Any <string>(), Arg.Any <string>()).Returns((Document)null);
                documentStoreProvider = Substitute.For <IDocumentStoreProvider>();
                documentStoreProvider.GetDocumentStore(Arg.Any <Guid>()).Returns(emptyUserHistoryStore);
            }

            return(new ModelsProvider(blobContainerProvider, documentStoreProvider, tempFolder));
        }
 public SupplierRepositoryRavenDb(
     IDocumentStoreProvider documentStoreProvider)
 {
     _documentStoreProvider = documentStoreProvider;
 }
 public CustomizationManager(IDocumentStoreProvider storeProvider)
 {
     _storeProvider = storeProvider ?? throw new ArgumentNullException(nameof(storeProvider));
 }
示例#8
0
 public AnalysisReportManager(IDocumentStoreProvider storeProvider, IConfigurationManager configurationManager, ILogger <AnalysisReportManager> logger)
 {
     _storeProvider        = storeProvider ?? throw new ArgumentNullException(nameof(storeProvider));
     _configurationManager = configurationManager ?? throw new ArgumentNullException(nameof(configurationManager));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public CompanyRepositoryRavenDb(IDocumentStoreProvider documentStoreProvider)
 {
     _documentStoreProvider = documentStoreProvider;
 }
 public ConfigurationManager(IDocumentStoreProvider documentStoreProvider, IExpirationManager expirationManager)
 {
     _storeProvider     = documentStoreProvider ?? throw new ArgumentNullException(nameof(documentStoreProvider));
     _expirationManager = expirationManager ?? throw new ArgumentNullException(nameof(expirationManager));
 }
 public SupplierRepositoryRavenDb(
    IDocumentStoreProvider documentStoreProvider)
 {
     _documentStoreProvider = documentStoreProvider;
 }
示例#12
0
 public CompanyRepositoryRavenDb(IDocumentStoreProvider documentStoreProvider)
 {
     _documentStoreProvider = documentStoreProvider;
 }