private void EmitSetupPropertyOverride(MethodBuilder methodBuilder, IPredicateMappingProvider termMapping) { var ilGenerator = methodBuilder.GetILGenerator(); ilGenerator.Emit(OpCodes.Nop); ilGenerator.Emit(OpCodes.Ldarg_1); ilGenerator.Emit(OpCodes.Ldstr, termMapping.GetTerm(_ontologyProvider).ToString()); ilGenerator.Emit(OpCodes.Newobj, typeof(Uri).GetConstructor(new[] { typeof(string) })); ilGenerator.Emit(OpCodes.Callvirt, typeof(ITermPart <PropertyMap>).GetMethod("Is", new Type[] { typeof(Uri) })); if (termMapping.ConverterType != null) { ilGenerator.Emit(OpCodes.Callvirt, typeof(IPropertyMap).GetMethod("ConvertWith").MakeGenericMethod(termMapping.ConverterType)); } ilGenerator.Emit(OpCodes.Pop); ilGenerator.Emit(OpCodes.Ret); }
public IPropertyMappingProvider Visit(DictionaryMap dictionaryMap, IPredicateMappingProvider key, IPredicateMappingProvider value) { var propertyMapping = CreatePropertyMapping(dictionaryMap, _log); return(new DictionaryMappingProvider(propertyMapping, key, value)); }
public IDictionaryMappingProvider Visit(DictionaryAttribute dictionaryAttribute, PropertyInfo property, IPredicateMappingProvider key, IPredicateMappingProvider value) { var prop = CreatePropertyMapping(dictionaryAttribute, property, _log); return(new DictionaryMappingProvider(prop, key, value)); }
/// <summary>Initializes a new instance of the <see cref="DictionaryMappingProvider"/> class.</summary> /// <param name="key">The key mapping provider.</param> /// <param name="value">The value mapping provider.</param> /// <param name="property">The property.</param> public DictionaryMappingProvider(IPropertyMappingProvider property, IPredicateMappingProvider key, IPredicateMappingProvider value) { _property = property; _key = key; _value = value; }
private Mock <IDictionaryMappingProvider> MakeDictionaryMappingProvider(string propertyName, IPredicateMappingProvider key, IPredicateMappingProvider value) { var result = new Mock <IDictionaryMappingProvider>(); result.SetupGet(instance => instance.PropertyInfo).Returns(typeof(TestPropertyInfo).GetProperty(propertyName)); result.SetupGet(instance => instance.Key).Returns(key); result.SetupGet(instance => instance.Value).Returns(value); return(result); }