コード例 #1
0
        /// <summary>
        /// Defines the field and adds it to the <see cref="Fields"/>.
        /// </summary>
        /// <param name="property">The underlying property.</param>
        /// <returns></returns>
        public FieldDef DefineField(PropertyInfo property)
        {
            ArgumentValidator.EnsureArgumentNotNull(property, "property");

            if (property.ReflectedType != UnderlyingType)
            {
                throw new DomainBuilderException(
                          string.Format(Strings.ExPropertyXMustBeDeclaredInTypeY, property.Name, UnderlyingType.GetFullName()));
            }

            FieldDef fieldDef = builder.DefineField(property);

            fields.Add(fieldDef);
            return(fieldDef);
        }