public PropertyAccessor( PropertyInfo propertyInfo, GetMemberDelegate publicGetter, SetMemberDelegate publicSetter) { PropertyInfo = propertyInfo; PublicGetter = publicGetter; PublicSetter = publicSetter; }
public AssignmentEntry(string name, AssignmentMember @from, AssignmentMember to) { Name = name; From = @from; To = to; GetValueFn = From.CreateGetter(); SetValueFn = To.CreateSetter(); ConvertValueFn = TypeConverter.CreateTypeConverter(From.Type, To.Type); }
public AssignmentEntry(string name, AssignmentMember @from, AssignmentMember to) { this.Name = name; this.From = @from; this.To = to; this.GetValueFn = this.From.CreateGetter(); this.SetValueFn = this.To.CreateSetter(); this.ConvertValueFn = TypeConverter.CreateTypeConverter(this.From.Type, this.To.Type); }
public FieldAccessor( FieldInfo fieldInfo, GetMemberDelegate publicGetter, SetMemberDelegate publicSetter, SetMemberRefDelegate publicSetterRef) { FieldInfo = fieldInfo; PublicGetter = publicGetter; PublicSetter = publicSetter; PublicSetterRef = publicSetterRef; }
public IdFieldSetter() { var allProperties = typeof(T).GetAllProperties(); var fieldIdProperty = allProperties.SingleOrDefault(p => p.HasAttribute <IdFieldAttribute>()); if (fieldIdProperty == null) { return; } _idFieldSetter = fieldIdProperty.CreateSetter(); }
public EntityPropertyAccessor() { var allProperties = typeof(T).GetAllProperties(); var nodeIdProperty = allProperties.SingleOrDefault(p => p.HasAttributeNamed(nameof(NodeIdAttribute))); if (nodeIdProperty == null) { return; } nodeIdPropertySetter = nodeIdProperty.CreateSetter(); nodeIdPropertyGetter = nodeIdProperty.CreateGetter(); }
public static void Init() { // Use reflection to avoid tfm builds and binary dependency on .NET Framework v4.7.2+ sameSiteFn = TypeProperties <HttpCookie> .GetAccessor("SameSite")?.PublicSetter; if (sameSiteFn != null) { var sameSiteMode = typeof(HttpCookie).Assembly.GetType("System.Web.SameSiteMode"); if (sameSiteMode != null) { sameSiteNone = (Enum)Enum.Parse(sameSiteMode, "None"); sameSiteStrict = (Enum)Enum.Parse(sameSiteMode, "Strict"); } } }
public PocoDataSource(IEnumerable <T> items, long nextIdSequence = 0) { this.items = new List <T>(items); this.idSequence = nextIdSequence; var checkPropExists = typeof(T).GetProperty("Id"); if (checkPropExists == null) { throw new ArgumentException($@"{typeof(T).Name} does not have an Id property", nameof(items)); } idProp = checkPropExists; idGetter = idProp.CreateGetter <T>(); idSetter = idProp.CreateSetter <T>(); defaultValue = idProp.PropertyType.GetDefaultValue(); }
public PropertySerializerEntry(SetMemberDelegate propertySetFn, ParseStringDelegate propertyParseStringFn) { PropertySetFn = propertySetFn; PropertyParseStringFn = propertyParseStringFn; }