internal static IList <PropertyDefinition> GetMappings(MdbPropertyMap map, PropertyDefinition[] propertiesToLoad) { List <PropertyDefinition> list = new List <PropertyDefinition>(); if (propertiesToLoad != null) { list = new List <PropertyDefinition>(propertiesToLoad.Length); foreach (PropertyDefinition propertyDefinition in propertiesToLoad) { MdbPropertyMapping mdbPropertyMapping; if (!map.TryGetValue(propertyDefinition, out mdbPropertyMapping)) { throw new KeyNotFoundException(string.Format("Could not get mapping for {0}.", propertyDefinition)); } list.AddRange(mdbPropertyMapping.StorePropertyDefinitions); } } return(list); }
internal MdbDocument(MdbCompositeItemIdentity identity, PropertyDefinition[] propertiesToPreload, Item item, MailboxSession session, MdbPropertyMap propertyMap, DocumentOperation operation) : this(identity, operation, new MdbDocumentAdapter(identity, propertiesToPreload, item, session, propertyMap, true)) { }
internal MdbDocument(MdbCompositeItemIdentity identity, PropertyDefinition[] propertiesToPreload, Item item, MdbPropertyMap propertyMap, DocumentOperation operation) : this(identity, propertiesToPreload, item, null, propertyMap, operation) { }
internal MdbDocument(MdbCompositeItemIdentity identity, PropertyDefinition[] propertiesToPreload, MailboxSession session, MdbPropertyMap propertyMap, DocumentOperation operation) : this(identity, propertiesToPreload, null, session, propertyMap, operation) { }
internal MdbDocumentAdapter(IDictionary <StorePropertyDefinition, object> preloadedProperties, MdbPropertyMap propertyMap) { Util.ThrowOnNullOrEmptyArgument <KeyValuePair <StorePropertyDefinition, object> >(preloadedProperties, "preloadedProperties"); Util.ThrowOnNullArgument(propertyMap, "propertyMap"); this.preloadedProperties = preloadedProperties; this.propertyMap = propertyMap; this.diagnosticsSession = DiagnosticsSession.CreateComponentDiagnosticsSession("MdbDocumentAdapter", ComponentInstance.Globals.Search.ServiceName, ExTraceGlobals.MdbDocumentAdapterTracer, (long)this.GetHashCode()); }
internal MdbDocumentAdapter(MdbCompositeItemIdentity id, PropertyDefinition[] propertiesToLoad, IItem item, MailboxSession session, MdbPropertyMap propertyMap, bool allowItemBind = true) { Util.ThrowOnNullArgument(id, "id"); Util.ThrowOnNullArgument(propertyMap, "propertyMap"); this.id = id; this.propertyMap = propertyMap; this.mappedPropertiesToLoadOnBind = MdbDocumentAdapter.GetMappings(this.propertyMap, propertiesToLoad); ExAssert.RetailAssert(this.mappedPropertiesToLoadOnBind != null, "Store Properties to load is null"); this.Item = item; this.Session = session; if (this.Item == null && this.Session == null) { throw new ArgumentException("session and item are both null"); } this.shouldDisposeItem = false; this.allowItemBind = allowItemBind; this.diagnosticsSession = DiagnosticsSession.CreateComponentDiagnosticsSession("MdbDocumentAdapter", ComponentInstance.Globals.Search.ServiceName, ExTraceGlobals.MdbDocumentAdapterTracer, (long)this.GetHashCode()); }
internal MdbDocumentAdapter(MdbCompositeItemIdentity id, PropertyDefinition[] propertiesToLoad, IItem item, MdbPropertyMap propertyMap) : this(id, propertiesToLoad, item, null, propertyMap, true) { }
internal MdbDocumentAdapter(MdbCompositeItemIdentity id, PropertyDefinition[] propertiesToLoad, MailboxSession session, MdbPropertyMap propertyMap) : this(id, propertiesToLoad, null, session, propertyMap, true) { }
internal MdbDocument CreateFullDocument(IDocument miniDocument, DocumentProcessingContext documentProcessingContext, MdbPropertyMap propertyMap, PropertyDefinition[] propertySet) { Util.ThrowOnNullArgument(miniDocument, "miniDocument"); Util.ThrowOnMismatchType <Document>(miniDocument, "miniDocument"); Util.ThrowOnNullArgument(miniDocument.Identity, "miniDocument.Identity"); Util.ThrowOnMismatchType <MdbCompositeItemIdentity>(miniDocument.Identity, "miniDocument.Identity"); Util.ThrowOnNullArgument(documentProcessingContext, "documentProcessingContext"); Util.ThrowOnNullArgument(documentProcessingContext.Session, "documentProcessingContext.Session"); MdbDocument mdbDocument = new MdbDocument((MdbCompositeItemIdentity)miniDocument.Identity, propertySet, documentProcessingContext.Session, propertyMap, miniDocument.Operation); ((Document)miniDocument).CopyPropertiesTo(mdbDocument); return(mdbDocument); }