Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public ValueListEntityProperty(Type implementationType, string propertyName, int position, ValueListFactory <TValue> valueFactory, ValueSliceFactory valueSliceFactory)
        {
            _position          = position;
            _valueFactory      = valueFactory;
            _valueSliceFactory = valueSliceFactory;

            _writeProperty = new WriteProperty <TEntity, ValueList <TValue> >(implementationType, propertyName);
        }
        public override void Apply(IEntityMapBuilder <TEntity, TSchema> builder)
        {
            ValueListFactory <TValue> factory = fragment => new EntityValueList <TValue>(fragment, _valueConverter);

            var mapper = new ValueListEntityProperty <TEntity, TValue>(builder.ImplementationType, Property.Name, Position, factory, Single);

            ITextSliceProvider <TEntity> provider = new ValueListSliceProvider <TEntity, TValue>(Property, _valueFormatter);

            builder.Add(mapper, provider);
        }