Exemplo n.º 1
0
        private AttachmentRetriever(string id, IdConverterDependencies converterDependencies)
        {
            bool flag = false;

            try
            {
                ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>((long)this.GetHashCode(), "Initialize IdAndSession to get attachment, id = {0}", id);
                List <AttachmentId> attachmentIds     = new List <AttachmentId>();
                IdHeaderInformation headerInformation = ServiceIdConverter.ConvertFromConcatenatedId(id, BasicTypes.ItemOrAttachment, attachmentIds);
                Item         item = null;
                IdAndSession idAndSession;
                try
                {
                    idAndSession = IdConverter.ConvertId(converterDependencies, headerInformation, IdConverter.ConvertOption.IgnoreChangeKey | IdConverter.ConvertOption.NoBind, BasicTypes.ItemOrAttachment, attachmentIds, null, this.GetHashCode(), false, ref item);
                }
                finally
                {
                    if (item != null)
                    {
                        item.Dispose();
                        item = null;
                    }
                }
                this.attachmentHierarchy = new AttachmentHierarchy(idAndSession, false, true);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    this.Dispose();
                }
            }
        }
Exemplo n.º 2
0
 internal static AttachmentHandler.IAttachmentRetriever CreateInstance(string id, IdConverterDependencies converterDependencies)
 {
     if (string.IsNullOrEmpty(id))
     {
         throw new ArgumentException("id cannot be null or empty");
     }
     if (converterDependencies == null)
     {
         throw new ArgumentException("converterDependencies cannot be null");
     }
     return(new AttachmentRetriever(id, converterDependencies));
 }