Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 public static IPersistentCollectionMemberInfo CreateCollection(this IPersistentClassInfo classInfo, IPersistentClassInfo persistentClassInfo, bool association = false)
 {
     return(classInfo.CreateCollection(persistentClassInfo.Name + "s", persistentClassInfo, association));
 }