Esempio n. 1
0
        /// <summary>
        /// Add the property information required for the persistence object
        /// </summary>
        public virtual StoreProperty AddProperty(string name, MemberInfo memberInfo)
        {
            CheckValue.NotNull(name, nameof(name));
            CheckValue.NotNull(memberInfo, nameof(memberInfo));

            // Currently, only property configuration is supported.
            // If memberinfo is a field type, an error will also be prompted
            if (memberInfo.MemberType != MemberTypes.Property)
            {
                throw new InvalidOperationException($"The {nameof(AddProperty)} method only property is supported," +
                                                    $" but the parameter '{nameof(memberInfo)}' type is {memberInfo.MemberType}.");
            }

            var propertyType = memberInfo.GetMemberType();
            var property     = new StoreProperty(name,
                                                 propertyType,
                                                 memberInfo as PropertyInfo,
                                                 memberInfo as FieldInfo,
                                                 memberInfo,
                                                 this);

            _properties.Add(name, property);

            return(property);
        }
        public InternalStorePropertyBuilder(StoreProperty storeProperty)
        {
            CheckValue.NotNull(storeProperty, nameof(storeProperty));

            Metadata = storeProperty;
        }