protected static IVersionedDocumentStoreClient CreateStoreLogic(
     IDocumentDbAccess dbAccess,
     DocumentStoreConfig config,
     IDocumentMetadataSource metadataSource)
 {
     return(new VersionedDocumentStoreClient(GetDbAccessImplementation(dbAccess), config, metadataSource));
 }
Пример #2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="DocumentDbAccessProvider"/> class.
        /// </summary>
        /// <param name="dbAccessFactory">The db access factory.</param>
        public DocumentDbAccessProvider(IDocumentDbAccessFactory dbAccessFactory)
        {
            if (dbAccessFactory == null)
            {
                throw new ArgumentNullException(nameof(dbAccessFactory));
            }

            _dbAccess = dbAccessFactory.Create();
        }
        protected static IVersionedDocumentStorePurgeClient CreatePurgeLogic(
            IDocumentDbAccess dbAccess,
            DocumentStoreConfig config)
        {
            var dbAccessImpl = GetDbAccessImplementation(dbAccess);
            var queryClient  = new VersionedDocumentQueryClient(dbAccessImpl, config);

            return(new VersionedDocumentStorePurgeClient(dbAccessImpl, config, queryClient));
        }
        private static DocumentDbAccess GetDbAccessImplementation(IDocumentDbAccess dbAccess)
        {
            var documentDbAccess = dbAccess as DocumentDbAccess;

            if (documentDbAccess == null)
            {
                throw new InvalidOperationException("Document db access interface is not a supported type");
            }

            return(documentDbAccess);
        }
Пример #5
0
        protected static IVersionedDocumentStoreClient CreateStoreLogic(IDocumentDbAccess dbAccess, DocumentStoreConfig config)
        {
            var documentDbAccess = dbAccess as DocumentDbAccess;

            if (documentDbAccess == null)
            {
                throw new InvalidOperationException("Document db access interface is not a supported type");
            }

            return(new VersionedDocumentStoreClient(documentDbAccess, config));
        }
Пример #6
0
        protected VersionedDocumentStore(IDocumentDbAccess dbAccess, IDocumentStoreConfigSource existingSource)
        {
            if (dbAccess == null)
            {
                throw new ArgumentNullException(nameof(dbAccess));
            }
            if (existingSource == null)
            {
                throw new ArgumentNullException(nameof(existingSource));
            }

            DbAccess = dbAccess;

            if (!dbAccess.ConfigRegistry.IsStoreConfigRegistered(existingSource))
            {
                throw new ArgumentException("Store config has not been registed");
            }
        }
Пример #7
0
 protected static IUnversionedDocumentStoreClient CreateStoreLogic(
     IDocumentDbAccess dbAccess,
     DocumentStoreConfig config)
 {
     return(new UnversionedDocumentStoreClient(GetDbAccessImplementation(dbAccess), config));
 }