예제 #1
0
        private string GetFileName(IBaseMessagePart part)
        {
            var receivedFileNameProperty = new ContextProperty(FileProperties.ReceivedFileName);
            var receivedFileName = part.PartProperties.Read(receivedFileNameProperty.PropertyName, receivedFileNameProperty.PropertyNamespace) as string;
            string fileName;
            string extension = string.Empty;
            if (!string.IsNullOrEmpty(receivedFileName))
            {
                fileName = receivedFileName;
            }
            else
            {
                if (!string.IsNullOrEmpty(part.ContentType))
                {
                    extension = MimeUtils.GetFileExtensionForMimeType(part.ContentType);
                }
                else if (!string.IsNullOrEmpty(DefaultZipEntryFileExtension))
                {
                    extension = string.Concat(".", DefaultZipEntryFileExtension);
                }


                fileName = Guid.NewGuid() + extension;
            }

            return fileName;
        }
예제 #2
0
        public static bool IsPromoted(this IBaseMessageContext ctx, ContextProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            return(ctx.IsPromoted(property.PropertyName, property.PropertyNamespace));
        }
예제 #3
0
        public static object Read(this IBaseMessagePart part, ContextProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            return(part.PartProperties.Read(property.PropertyName, property.PropertyNamespace));
        }
        public static bool TryRead(this IBaseMessageContext ctx ,ContextProperty property, out object val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            return ((val = ctx.Read(property.PropertyName, property.PropertyNamespace)) != null);
        }
예제 #5
0
        public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out object val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            return((val = ctx.Read(property.PropertyName, property.PropertyNamespace)) != null);
        }
        public static object Read(this IBaseMessageContext ctx, ContextProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            return ctx.Read(property.PropertyName, property.PropertyNamespace);
        }
예제 #7
0
        public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out string val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            val = ctx.Read(property.PropertyName, property.PropertyNamespace) as string;

            return(!string.IsNullOrWhiteSpace(val));
        }
        public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out string val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            val = ctx.Read(property.PropertyName, property.PropertyNamespace) as string;

            return !string.IsNullOrWhiteSpace(val);
        }
예제 #9
0
        public static void Write(this IBaseMessagePart part, ContextProperty property, object val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            if (val == null)
            {
                throw new ArgumentNullException("val");
            }

            part.PartProperties.Write(property.PropertyName, property.PropertyNamespace, val);
        }
예제 #10
0
        public static void Promote(this IBaseMessageContext ctx, ContextProperty property, object val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            if (val == null)
            {
                throw new ArgumentNullException("val");
            }

            ctx.Promote(property.PropertyName, property.PropertyNamespace, val);
        }
        public static void Promote(this IBaseMessageContext ctx, ContextProperty property, object val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            if (val == null)
            {
                throw new ArgumentNullException("val");
            }

            ctx.Promote(property.PropertyName,property.PropertyNamespace,val);
        }
예제 #12
0
        public static bool TryRead <T>(this IBaseMessageContext ctx, ContextProperty property, out T val)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }
            object content = ctx.Read(property.PropertyName, property.PropertyNamespace);

            if (content is T)
            {
                val = (T)content;
                return(true);
            }
            else
            {
                val = default(T);
                return(false);
            }
        }
예제 #13
0
        public static void Copy(this IBaseMessageContext ctx, ContextProperty source, ContextProperty destination)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }

            object sourceValue;

            if (!ctx.TryRead(source, out sourceValue))
            {
                throw new InvalidOperationException("Could not find the specified source property in BizTalk context.");
            }

            ctx.Promote(destination, sourceValue);
        }
        public static void Copy(this IBaseMessageContext ctx, ContextProperty source, ContextProperty destination)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }

            object sourceValue;

            if (!ctx.TryRead(source, out sourceValue))
            {
                throw new InvalidOperationException("Could not find the specified source property in BizTalk context.");
            }

            ctx.Promote(destination, sourceValue);
        }
예제 #15
0
        public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out string val)
        {
            TryRead <string>(ctx, property, out val);

            return(!string.IsNullOrWhiteSpace(val));
        }
예제 #16
0
 public static bool TryRead(this IBaseMessageContext ctx, ContextProperty property, out object val)
 {
     return(TryRead <object>(ctx, property, out val));
 }