示例#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);
        }