public ValueEntityProperty(Type implementationType, string propertyName, int position, ValueFactory <TValue> valueFactory) { _position = position; _valueFactory = valueFactory; _writeProperty = new WriteProperty <TEntity, Value <TValue> >(implementationType, propertyName); }
public Property(PropertyInfo propertyInfo) { mName = propertyInfo.Name; mTypeData = propertyInfo.PropertyType.GetTypeData(); mRead = propertyInfo.GetValue; mWrite = propertyInfo.SetValue; }
public ValueListEntityProperty(Type implementationType, string propertyName, int position, ValueListFactory <TValue> valueFactory, ValueSliceFactory valueSliceFactory) { if (implementationType == null) { throw new ArgumentNullException(nameof(implementationType)); } if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } if (valueFactory == null) { throw new ArgumentNullException(nameof(valueFactory)); } if (valueSliceFactory == null) { throw new ArgumentNullException(nameof(valueSliceFactory)); } _position = position; _valueFactory = valueFactory; _valueSliceFactory = valueSliceFactory; _writeProperty = new WriteProperty <TEntity, ValueList <TValue> >(implementationType, propertyName); }
public TranslateEntityValuePropertyTranslator(Type implementationType, PropertyInfo entityPropertyInfo, PropertyInfo inputPropertyInfo, IEntityTranslator <TEntity, TSchema> entityTranslator) { _entityTranslator = entityTranslator; _propertyName = entityPropertyInfo.Name; _property = new WriteProperty <TResult, Value <TEntity> >(implementationType, _propertyName); _inputProperty = new ReadOnlyProperty <TInput, Value <TEntity> >(inputPropertyInfo); }
/// <summary> /// 判定属性是否是读写属性。 /// </summary> /// <param name="propertyName">表示属性名称。</param> /// <returns>返回属性是否是读写属性。</returns> public bool IsWriteProperty(string propertyName) { if (WriteProperty.Contains(propertyName)) { return(true); } return(false); }
/// <summary> /// 将属性加入读写属性集合中。 /// </summary> /// <param name="propertyNames">属性名称集合字符串,以';'号隔开。</param> protected void AddWritePropertyRange(string propertyNames) { string[] propertyNameArray = propertyNames.Split(';'); foreach (string s in propertyNameArray) { WriteProperty.Add(s); } }
public SetValuePropertyTranslator(Type implementationType, PropertyInfo entityPropertyInfo, PropertyInfo inputPropertyInfo, SetValueProvider <TInput, TSchema, TPropertyEntity> valueProvider) { _valueProvider = valueProvider; _propertyName = entityPropertyInfo.Name; _property = new WriteProperty <TEntity, Value <TPropertyEntity> >(implementationType, _propertyName); _inputProperty = new ReadOnlyProperty <TInput, Value <TPropertyEntity> >(inputPropertyInfo); }
public DynamicEntityFactory(EntityInfo entityInfo, IEnumerable <IEntityInitializer <TEntity> > initializers) { _entityInfo = entityInfo; _initializers = initializers.ToArray(); _entityInfoProperty = new WriteProperty <TEntity, EntityInfo>(typeof(TImplementation), nameof(Entity.EntityInfo)); }
/// <summary> /// Writes the properties of an instance to a delegate if not decorated with the DoNoTOutput attribute /// </summary> /// <param name="item">The item to output</param> /// <param name="writer">The method to invoke for writing a property value</param> public static void WriteConfiguration(object item, WriteProperty writer) { foreach (var property in item.GetType().GetProperties()) { if (Attribute.GetCustomAttribute(property, typeof(DoNotOutputAttribute)) == null) { if (property.GetMethod != null) { writer(property.Name, property.GetMethod.Invoke(item, null), property.PropertyType); } } } }
object Evaluate(WriteProperty p) { _reflection.SetPropertyValue(Evaluate(p.Object), p.Property.Name, Evaluate(p.Value)); return(null); }
public EntityLayoutProperty(Type implementationType, PropertyInfo property, bool required, Func <Entity <TEntity>, TProperty> propertyConverter) { _required = required; _propertyConverter = propertyConverter; _property = new WriteProperty <TLayout, TProperty>(implementationType, property.Name); }
public ExcludeValueListPropertyTranslator(Type implementationType, PropertyInfo entityPropertyInfo) { _propertyName = entityPropertyInfo.Name; _property = new WriteProperty <TEntity, ValueList <TPropertyEntity> >(implementationType, _propertyName); _readProperty = new ReadProperty <TEntity, ValueList <TPropertyEntity> >(implementationType, _propertyName); }
public PropertyEntityInitializer(Type implementationType, string propertyName, TValue value) { _value = value; _writeProperty = new WriteProperty <TEntity, Value <TValue> >(implementationType, propertyName); }
public LayoutLayoutProperty(Type implementationType, PropertyInfo property, ILayoutParserFactory <T, TSchema> layout, bool required) { _layout = layout; _required = required; _property = new WriteProperty <TLayout, Layout <T> >(implementationType, property.Name); }
public CopyValueListPropertyTranslator(Type implementationType, PropertyInfo entityPropertyInfo, PropertyInfo inputPropertyInfo) { _property = new WriteProperty <TEntity, ValueList <TPropertyEntity> >(implementationType, entityPropertyInfo.Name); _inputProperty = new ReadOnlyProperty <TInput, ValueList <TPropertyEntity> >(inputPropertyInfo); }
public ValueEntityPropertyConverter(Type implementationType, string propertyName, ValueFactory <TValue> valueFactory) { _valueFactory = valueFactory; _writeProperty = new WriteProperty <TEntity, Value <TValue> >(implementationType, propertyName); }
public CopyValueListPropertyTranslator(Type implementationType, PropertyInfo entityPropertyInfo, PropertyInfo inputPropertyInfo) { _propertyName = entityPropertyInfo.Name; _property = new WriteProperty <TResult, ValueList <TValue> >(implementationType, _propertyName); _inputProperty = new ReadOnlyProperty <TInput, ValueList <TValue> >(inputPropertyInfo); }
public DynamicEntityFactory(Type implementationType, EntityInfo entityInfo) { _entityInfo = entityInfo; _new = CompileNewMethod(implementationType); _entityTypeProperty = new WriteProperty <TEntity, EntityInfo>(implementationType, nameof(Entity.EntityInfo)); }
public SetPropertyTranslator(Type implementationType, PropertyInfo propertyInfo, ITranslatePropertyProvider <TProperty, TInput, TSchema> propertyProvider) { _propertyProvider = propertyProvider; _property = new WriteProperty <TEntity, TProperty>(implementationType, propertyInfo.Name); }