예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="builder">The parent builder.</param>
        /// <param name="field">The field to build on.</param>
        internal FieldBuilder(IContractBuilder <T> builder, RuntimeField field) : base(builder)
        {
            Instance = field;

            if (Instance.Accessor == null)
            {
                Instance.Accessor = RuntimeFieldAccessor.From <T>(Instance.Name);
            }
        }
예제 #2
0
        /// <summary>
        /// Renames the field.
        /// </summary>
        /// <param name="name">The new name to apply to the field.</param>
        /// <returns>The field builder to continue building on.</returns>
        /// <remarks>If the mapping property has not been set, the current name is set
        /// as the mapping property and then the new name is applied.</remarks>
        public FieldBuilder <T> Rename(string name)
        {
            if (Instance.Accessor == null)
            {
                Accessor(RuntimeFieldAccessor.From <T>(Instance.Name));
            }

            Instance.Name = name;

            return(this);
        }
        /// <summary>
        /// Sets the property that the field is to be mapped to.
        /// </summary>
        /// <param name="property">The name of the property that the field is mapped to.</param>
        /// <returns>The relationship builder to continue building on.</returns>
        public RelationshipBuilder <T> From(string property)
        {
            Instance.Accessor = RuntimeFieldAccessor.From <T>(property);

            return(this);
        }
예제 #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="propertyInfo">The property information to create the field from.</param>
 protected RuntimeField(PropertyInfo propertyInfo)
 {
     Name = propertyInfo.Name;
     Accessor = new RuntimeFieldAccessor(propertyInfo);
     Options = CreateDefaultOptions(propertyInfo);
 }