protected FieldInstance EnsureBackingField(IPropertyInfo propertyInfo) { FieldInfo backingField = propertyInfo.BackingField; FieldInstance f_backingField; if (backingField != null) { return(new FieldInstance(backingField)); } else if (propertyInfo.DeclaringType.IsInterface || propertyInfo.DeclaringType.Attributes.HasFlag(TypeAttributes.Abstract)) { String fieldName = StringConversionHelper.LowerCaseFirst(propertyInfo.Name); f_backingField = State.GetAlreadyImplementedField(fieldName); if (f_backingField == null) { // add field f_backingField = new FieldInstance(FieldAttributes.Family, StringConversionHelper.LowerCaseFirst(propertyInfo.Name), NewType.GetType(propertyInfo.PropertyType)); f_backingField = ImplementField(f_backingField); } return(f_backingField); } return(null); }
public MethodInfo GetMethod(Type serviceType) { if (method == null) { method = serviceType.GetMethod(StringConversionHelper.UpperCaseFirst(MethodName), ParamTypes); if (method == null) { method = serviceType.GetMethod(StringConversionHelper.LowerCaseFirst(MethodName), ParamTypes); } if (method == null) { throw new Exception("No matching method found on type " + serviceType.FullName + "'"); } } return(method); }