public static TypedMessageConverter Create(System.Type messageContract, string action, string defaultNamespace, DataContractFormatAttribute formatterAttribute) { if (messageContract == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("messageContract")); } if (!messageContract.IsDefined(typeof(MessageContractAttribute), false)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("SFxMessageContractAttributeRequired", new object[] { messageContract }), "messageContract")); } if (defaultNamespace == null) { defaultNamespace = "http://tempuri.org/"; } return new XmlMessageConverter(GetOperationFormatter(messageContract, formatterAttribute, defaultNamespace, action)); }
private bool IsSubclass(System.Type type, System.Type attribute) { return type.IsDefined(attribute, false); }
private bool IsClass(System.Type type) { return type.IsDefined(typeof(ClassAttribute), false); }
/// <summary> /// This method adds the fields only if they do not already exist in the array /// </summary> /// <param name="_tableFields"></param> /// <param name="propInfo"></param> private static void AddDataObjectFieldProperties(List<Adage.EF.Interfaces.BusinessObjectStructure> _tableFields, System.Reflection.PropertyInfo propInfo) { Adage.EF.Interfaces.BusinessObjectStructure currStruct; System.ComponentModel.DataObjectFieldAttribute dataPropInfo; if (propInfo.IsDefined(dataPropType, true)) { bool alreadyContainsProperty = false; _tableFields.ForEach(p => alreadyContainsProperty = p.Name == propInfo.Name ? true : alreadyContainsProperty); if (!alreadyContainsProperty) { dataPropInfo = (System.ComponentModel.DataObjectFieldAttribute)Attribute.GetCustomAttribute(propInfo, dataPropType); currStruct = new Adage.EF.Interfaces.BusinessObjectStructure( propInfo.PropertyType, propInfo.Name, dataPropInfo.IsNullable, dataPropInfo.Length, false, null, propInfo); _tableFields.Add(currStruct); } } }
/// <summary> /// Returns <c>true</c> if either <see cref="CacheResultAttribute"/> or /// <see cref="CacheResultItemsAttribute"/> is applied to the /// <paramref name="method"/>. /// </summary> /// <param name="method"> /// Method to check. /// </param> /// <param name="targetType"> /// Type of target object. /// </param> /// <returns> /// <c>true</c> if either <see cref="CacheResultAttribute"/> or /// <see cref="CacheResultItemsAttribute"/> is applied to the /// <paramref name="method"/>; <c>false</c> otherwise. /// </returns> public override bool Matches(System.Reflection.MethodInfo method, Type targetType) { return method.IsDefined(typeof (CacheResultAttribute), Inherit) || method.IsDefined(typeof (CacheResultItemsAttribute), Inherit); }