コード例 #1
0
        /// <summary>
        /// 初始化属性的值。
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        public virtual void InitializeValue(IProperty property, PropertyValue value)
        {
            if (property is RelationProperty)
            {
                InnerLazyMgr.SetValueCreated(property.Name);
            }

            InnerEntry.Initializate(property.Name, value);
        }
コード例 #2
0
        /// <summary>
        /// 内部设置属性值的方法。
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        private void InternalSetValue(IProperty property, PropertyValue value)
        {
            if (PropertyValue.IsEmpty(value))
            {
                if (SetNullable(property))
                {
                    return;
                }
            }

            if (property is RelationProperty)
            {
                InnerLazyMgr.SetValueCreated(property.Name);
            }

            InnerEntry.Modify(property.Name, value);
        }
コード例 #3
0
        /// <summary>
        /// 处理附加属性的值。
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        private PropertyValue ProcessSupposedProperty(IProperty property)
        {
            if (property is RelationProperty relationProperty &&
                relationProperty.Options.LoadBehavior != LoadBehavior.None)
            {
                var value = EntityLazyloader.Load(this, relationProperty);

                if (value != null && !PropertyValue.IsEmpty(value))
                {
                    InnerLazyMgr.SetValueCreated(property.Name);
                    value._dataType = property.Info.DataType;
                    InnerEntry.Initializate(property.Name, value);
                }

                return(value);
            }

            return(PropertyValue.Empty);
        }
コード例 #4
0
        /// <summary>
        /// 处理附加属性的值。
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        private PropertyValue ProcessSupposedProperty(IProperty property)
        {
            var relationProperty = property.As <RelationProperty>();

            if (relationProperty != null &&
                relationProperty.Options.LoadBehavior != LoadBehavior.None)
            {
                var value = EntityLazyloader.Load(this, relationProperty);
                InnerLazyMgr.SetValueCreated(property.Name);

                if (value != null)
                {
                    InnerEntry.Initializate(property.Name, value, () => value.DataType = property.Info.DataType);
                }

                return(value);
            }

            return(PropertyValue.Empty);
        }