示例#1
0
        public IBindField <T> Field <TPropertyType>(
            Expression <Func <T, TPropertyType> > field)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            IComplexTypeFieldBindingBuilder fieldBuilder =
                ComplexTypeFieldBindingBuilder.New()
                .SetMember(field.ExtractMember());

            _typeBuilder.AddField(fieldBuilder);
            return(new BindField <T>(_typeBuilder, fieldBuilder));
        }
        public IComplexTypeBindingBuilder AddField(
            Action <IComplexTypeFieldBindingBuilder> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var builder = new ComplexTypeFieldBindingBuilder();

            configure(builder);

            if (builder.IsComplete())
            {
                _bindingInfo.Fields = _bindingInfo.Fields.Add(builder.Create());
                return(this);
            }

            // TODO : resources
            throw new ArgumentException("notcompleted", nameof(builder));
        }
        public IComplexTypeBindingBuilder AddField(
            Action <IComplexTypeFieldBindingBuilder> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var builder = new ComplexTypeFieldBindingBuilder();

            configure(builder);

            if (builder.IsComplete())
            {
                _fields.Add(builder);
                return(this);
            }

            throw new ArgumentException(
                      TypeResources.ComplexTypeBindingBuilder_FieldNotComplete,
                      nameof(configure));
        }