예제 #1
0
        public static int GetHashCode(RavenIndexDataModel indexModel)
        {
            var documentStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName);

            var definition = documentStore.DatabaseCommands.GetIndex(indexModel.IndexName);

            if (documentStore == null)
            {
                throw new InvalidOperationException("Index definition is null.");
            }

            return definition.GetHashCode();
        }
예제 #2
0
        public static void Copy(RavenIndexDataModel indexModel, string targetServerName)
        {
            var sourceStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName);

            var targetStore = GetTenantDocumentStore(targetServerName, indexModel.StoreName);

            var sourceIndexDefinition = sourceStore.DatabaseCommands.GetIndex(indexModel.IndexName);

            if (sourceIndexDefinition == null)
            {
                throw new InvalidOperationException("Index definition is null.");
            }

            targetStore.DatabaseCommands
                .PutIndex(indexModel.IndexName, sourceIndexDefinition, overwrite: true);
        }
예제 #3
0
        public static QueryResult GetZeroPageQueryResult(RavenIndexDataModel indexModel)
        {
            var documentStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName);

            var queryResult = documentStore.DatabaseCommands
                .Query(indexModel.IndexName, new IndexQuery { PageSize = 0 }, null);

            return queryResult;
        }
예제 #4
0
        public static void Delete(RavenIndexDataModel indexModel)
        {
            var documentStore = GetTenantDocumentStore(indexModel.ServerName, indexModel.StoreName);

            documentStore.DatabaseCommands.DeleteIndex(indexModel.IndexName);
        }