private Action<ILProcessor> GetTermUriInjectMethod(CustomAttribute dictionaryAttribute) { if (dictionaryAttribute.IsQNameConstructor()) { string prefix = dictionaryAttribute.ConstructorArguments[0].Value.ToString(); string term = dictionaryAttribute.ConstructorArguments[1].Value.ToString(); return processor => InjectCollectionAsQName(processor, prefix, term); } if (dictionaryAttribute.IsUriStringConstructor()) { string uriString = dictionaryAttribute.ConstructorArguments[0].Value.ToString(); return processor => InjectCollectionAsUri(processor, uriString); } throw new InvalidOperationException("Unrecognized DictionaryAttribute constructor"); }
private Action<ILProcessor> GetPropertyMappingCode(CustomAttribute attribute) { if (attribute == null) { return null; } if (attribute.IsQNameConstructor()) { string prefix = attribute.ConstructorArguments[0].Value.ToString(); string term = attribute.ConstructorArguments[1].Value.ToString(); return processor => InjectPropertyAsQName(processor, prefix, term); } if (attribute.IsUriStringConstructor()) { string uriString = attribute.ConstructorArguments[0].Value.ToString(); return processor => InjectPropertyAsUri(processor, uriString); } throw new InvalidOperationException(string.Format("Unrecognized '{0}' constructor", attribute.AttributeType.FullName)); }