Пример #1
0
        void createTheManyPart(IPersistentReferenceMemberInfo persistentReferenceMemberInfo)
        {
            IPersistentClassInfo classInfo = PersistentClassInfoQuery.Find(((XPObjectSpace)ObjectSpace).Session, persistentReferenceMemberInfo.ReferenceTypeFullName);
            string collectionPropertyName  = persistentReferenceMemberInfo.Name + "s";

            if (classInfo != null && classInfo.OwnMembers.FirstOrDefault(info => info.Name == collectionPropertyName) == null)
            {
                var associationAttribute = PersistentAttributeInfoQuery.Find <AssociationAttribute>(persistentReferenceMemberInfo);
                classInfo.CreateCollection(persistentReferenceMemberInfo.Owner.PersistentAssemblyInfo.Name,
                                           persistentReferenceMemberInfo.Owner.Name).CreateAssociation(associationAttribute.Name);
            }
        }
Пример #2
0
 void IPersistentReferenceMemberInfo.SetReferenceTypeFullName(string value)
 {
     ReferenceTypeFullName = value;
     if (_referenceType == null && _referenceClassInfo == null && value != null)
     {
         IPersistentClassInfo classInfo = PersistentClassInfoQuery.Find(Session, value);
         if (classInfo != null)
         {
             _referenceClassInfo = (PersistentClassInfo)classInfo;
         }
         else
         {
             _referenceType = ReflectionHelper.GetType(value.Substring(value.LastIndexOf(".") + 1));
         }
     }
 }
 void IPersistentCollectionMemberInfo.SetCollectionTypeFullName(string s)
 {
     CollectionTypeFullName = s;
     if (_collectionType == null && _collectionClassInfo == null && s != null)
     {
         IPersistentClassInfo classInfo = PersistentClassInfoQuery.Find(Session, s);
         if (classInfo != null)
         {
             _collectionClassInfo = (PersistentClassInfo)classInfo;
         }
         else
         {
             _collectionType = ReflectionHelper.GetType(s.Substring(s.LastIndexOf(".") + 1));
         }
     }
 }
Пример #4
0
        public static void SetTypeValue(this IPersistentTypeInfo persistentTypeInfo, ref IPersistentClassInfo persistentClassInfo, ref Type type, string typeFullName)
        {
            var session = persistentTypeInfo.Session;

            if (!string.IsNullOrEmpty(typeFullName))
            {
                IPersistentClassInfo classInfo = PersistentClassInfoQuery.Find(session, typeFullName);
                if (classInfo != null)
                {
                    persistentClassInfo = classInfo;
                }
                else
                {
                    type = ReflectionHelper.GetType(typeFullName.Substring(typeFullName.LastIndexOf(".", StringComparison.Ordinal) + 1));
                }
            }
        }