コード例 #1
0
        protected override IPropertyType[] CreateTargetPropertyTypes(IBeanMetaData bmd, object bean, string[] propertyNames)
        {
            IDictionary modifiedPropertyNames = bmd.GetModifiedPropertyNames(bean);
            IList       types = new ArrayList();
            string      timestampPropertyName = bmd.TimestampPropertyName;
            string      versionNoPropertyName = bmd.VersionNoPropertyName;

            for (int i = 0; i < propertyNames.Length; ++i)
            {
                IPropertyType pt = bmd.GetPropertyType(propertyNames[i]);
                if (pt.IsPrimaryKey == false)
                {
                    string propertyName = pt.PropertyName;
                    if (propertyName.Equals(timestampPropertyName, StringComparison.CurrentCultureIgnoreCase) ||
                        propertyName.Equals(versionNoPropertyName, StringComparison.CurrentCultureIgnoreCase) ||
                        modifiedPropertyNames.Contains(propertyName))
                    {
                        types.Add(pt);
                    }
                }
            }
            IPropertyType[] propertyTypes = new IPropertyType[types.Count];
            types.CopyTo(propertyTypes, 0);
            return(propertyTypes);
        }
コード例 #2
0
        protected virtual IPropertyType[] CreateTargetPropertyTypes(IBeanMetaData bmd, object bean, string[] propertyNames)
        {
            IList  types = new ArrayList();
            String timestampPropertyName = bmd.TimestampPropertyName;
            String versionNoPropertyName = bmd.VersionNoPropertyName;

            for (int i = 0; i < propertyNames.Length; ++i)
            {
                IPropertyType pt = bmd.GetPropertyType(propertyNames[i]);
                if (IsTargetProperty(pt, timestampPropertyName, versionNoPropertyName, bean))
                {
                    types.Add(pt);
                }
            }
            IPropertyType[] propertyTypes = new IPropertyType[types.Count];
            types.CopyTo(propertyTypes, 0);
            return(propertyTypes);
        }
コード例 #3
0
        protected override void SetupPropertyCache(RelationRowCreationResource res)
        {
            // - - - - - - - - - - -
            // Recursive Call Point!
            // - - - - - - - - - - -
            res.InitializePropertyCacheElement();

            // Do only selected foreign property for performance if condition-bean exists.
            if (HasConditionBean(res) && !HasSelectedForeignInfo(res))
            {
                return;
            }

            // Set up property cache about current beanMetaData.
            IBeanMetaData nextBmd = res.GetRelationBeanMetaData();

            for (int i = 0; i < nextBmd.PropertyTypeSize; ++i)
            {
                IPropertyType pt = nextBmd.GetPropertyType(i);
                res.CurrentPropertyType = pt;
                if (!IsTargetProperty(res))
                {
                    continue;
                }
                SetupPropertyCacheElement(res);
            }

            // Set up next relation.
            if (res.HasNextRelationProperty() && (HasConditionBean(res) || res.HasNextRelationLevel()))
            {
                res.BackupRelationPropertyType();
                res.IncrementCurrentRelationNestLevel();
                try {
                    SetupNextPropertyCache(res, nextBmd);
                } finally {
                    res.RestoreRelationPropertyType();
                    res.DecrementCurrentRelationNestLevel();
                }
            }
        }