示例#1
0
 public static void CreateMapRelationship(INode mapNode, INode childNode)
 {
     if (childNode != null && mapNode != null)
     {
         foreach (IDescriptor descriptor in childNode.Descriptors)
         {
             if (descriptor.Relationship is CompendiumMapRelationship)
             {
                 foreach (IDescriptor altDesc in descriptor.Relationship.Descriptors)
                 {
                     if (altDesc.DescriptorType is CompendiumToDescriptor)
                     {
                         if (altDesc.Node.Id == mapNode.Id)
                         {
                             return;
                         }
                     }
                 }
             }
         }
         CompendiumMapRelationship mapRelationship = new CompendiumMapRelationship();
         mapRelationship.Id = mapNode.Id + childNode.Id;
         IDescriptor toDescriptor   = new CompendiumRelationshipDescriptor(mapNode, mapRelationship, IoCContainer.GetInjectionInstance().GetInstance <CompendiumToDescriptor>());
         IDescriptor fromDescriptor = new CompendiumRelationshipDescriptor(childNode, mapRelationship, IoCContainer.GetInjectionInstance().GetInstance <CompendiumFromDescriptor>());
         mapRelationship.Descriptors = new IDescriptor[] { fromDescriptor, toDescriptor };
         childNode.AddDescriptor(fromDescriptor);
         mapNode.AddDescriptor(toDescriptor);
     }
 }
 public static void CreateMapRelationship(INode mapNode, INode childNode)
 {
     if (childNode != null && mapNode != null)
     {
         foreach (IDescriptor descriptor in childNode.Descriptors)
         {
             if (descriptor.Relationship is CompendiumMapRelationship)
             {
                 foreach (IDescriptor altDesc in descriptor.Relationship.Descriptors)
                 {
                     if (altDesc.DescriptorType is CompendiumToDescriptor)
                     {
                         if (altDesc.Node.Id == mapNode.Id)
                         {
                             return;
                         }
                     }
                 }
             }
         }
         CompendiumMapRelationship mapRelationship = new CompendiumMapRelationship();
         mapRelationship.Id = mapNode.Id + childNode.Id;
         IDescriptor toDescriptor = new CompendiumRelationshipDescriptor(mapNode, mapRelationship, IoCContainer.GetInjectionInstance().GetInstance<CompendiumToDescriptor>());
         IDescriptor fromDescriptor = new CompendiumRelationshipDescriptor(childNode, mapRelationship, IoCContainer.GetInjectionInstance().GetInstance<CompendiumFromDescriptor>());
         mapRelationship.Descriptors = new IDescriptor[] { fromDescriptor, toDescriptor };
         childNode.AddDescriptor(fromDescriptor);
         mapNode.AddDescriptor(toDescriptor);
     }
 }