public void PopulateAndQueryStorageFeaturesWithImHashMap() { foreach (var v in values) { storageFeaturesWithImHashMap.MappingFor(v); } foreach (var v in values) { storageFeaturesWithImHashMap.MappingFor(v); } }
public static void ShouldContainIndexDefinitionFor <TDocument>( this StorageFeatures storage, string tableName = "fulltext.mt_doc_target", string indexName = "mt_doc_target_idx_fts", string regConfig = "english", string dataConfig = null) { var documentMapping = storage.MappingFor(typeof(TDocument)); var table = new DocumentTable(documentMapping); var ddl = documentMapping.Indexes .Where(x => x.Name == indexName) .Select(x => x.ToDDL(table)) .FirstOrDefault(); ddl.ShouldNotBeNull(); SpecificationExtensions.ShouldContain(ddl, $"CREATE INDEX {indexName}"); SpecificationExtensions.ShouldContain(ddl, $"ON {tableName}"); SpecificationExtensions.ShouldContain(ddl, $"to_tsvector('{regConfig}',{dataConfig})"); if (regConfig != null) { SpecificationExtensions.ShouldContain(ddl, regConfig); } if (dataConfig != null) { SpecificationExtensions.ShouldContain(ddl, dataConfig); } }
public static void ShouldContainIndexDefinitionFor <TDocument>( this StorageFeatures storage, string tableName = "public.mt_doc_target", string indexName = "mt_doc_target_idx_fts", string regConfig = "english", string dataConfig = null) { var ddl = storage.MappingFor(typeof(TDocument)).Indexes .Where(x => x.IndexName == indexName) .Select(x => x.ToDDL()) .FirstOrDefault(); ddl.ShouldNotBeNull(); ddl.ShouldContain($"CREATE INDEX {indexName}"); ddl.ShouldContain($"ON {tableName}"); ddl.ShouldContain($"to_tsvector('{regConfig}', {dataConfig})"); if (regConfig != null) { ddl.ShouldContain(regConfig); } if (dataConfig != null) { ddl.ShouldContain(dataConfig); } }
public Table ExistingTableFor(Type type) { var mapping = _features.MappingFor(type).As <DocumentMapping>(); var expected = new DocumentTable(mapping); using (var conn = _tenant.CreateConnection()) { conn.Open(); return(expected.FetchExisting(conn)); } }
private IIncludeJoin doGetJoin <TInclude>(ICompiledQuery <TDoc, TOut> query, IncludeResultOperator includeOperator, IIncludeCallbackResolver <TInclude> callbackResolver) where TInclude : class { var idSource = includeOperator.IdSource as Expression <Func <TDoc, object> >; var joinType = (JoinType)includeOperator.JoinType.Value; var visitor = new FindMembers(); visitor.Visit(idSource); var members = visitor.Members.ToArray(); var mapping = _storage.MappingFor(typeof(TDoc)).ToQueryableDocument(); var typeContainer = new IncludeTypeContainer { IncludeType = includeOperator.Callback.Body.Type }; var property = typeof(IncludeResultOperator).GetProperty("Callback"); var callback = callbackResolver.Resolve(property, typeContainer); var included = _storage.MappingFor(typeContainer.IncludeType).ToQueryableDocument(); return(mapping.JoinToInclude(joinType, included, members, callback)); }
public void property_searching_override() { theStorage.MappingFor(typeof(User)).As <DocumentMapping>() .PropertySearching.ShouldBe(PropertySearching.JSON_Locator_Only); }