Inheritance: Proxy.IRelationship, Proxy.IFacade
示例#1
0
        public Proxy.IRelationship CreateRelationship(TransactionFramework.ISoapTransactionLink transactionLink, Guid domainId, Guid rootMapId, Dictionary <Proxy.ConnectionType, Proxy.INode> nodes, Proxy.RelationshipType relationshipType, string originalId)
        {
            FacadeRelationship facadeRelationship = new FacadeRelationship();

            InProcess.InProcessRelationship relationship = new InProcess.InProcessRelationship(MapManager);
            relationship.OriginLink       = transactionLink;
            relationship.Facade           = facadeRelationship;
            relationship.Id               = Guid.NewGuid();
            relationship.DomainId         = domainId;
            relationship.RootMapId        = rootMapId;
            relationship.RelationshipType = relationshipType;
            relationship.OriginalId       = originalId;
            relationship.Status           = Proxy.LoadState.Full;

            facadeRelationship.BaseRelationship = relationship;

            foreach (KeyValuePair <Proxy.ConnectionType, Proxy.INode> relationshipContext in nodes)
            {
                Proxy.ConnectionSet connection = Proxy.ConnectionSetFactory.Instance.GetConnection(relationshipContext.Value, facadeRelationship, relationshipContext.Key);

                Proxy.INodeManager newRelationshipNodes = relationship.Nodes;
                newRelationshipNodes.Load(connection);

                Proxy.IRelationshipManager nodeRelationships = relationshipContext.Value.Relationships;
                nodeRelationships.Load(connection);
            }

            InProcessRelationships.Add(transactionLink, facadeRelationship);

            return(facadeRelationship);
        }
        public Proxy.IRelationship CreateRelationship(TransactionFramework.ISoapTransactionLink transactionLink, Guid domainId, Guid rootMapId, Dictionary<Proxy.ConnectionType, Proxy.INode> nodes, Proxy.RelationshipType relationshipType, string originalId)
        {
            FacadeRelationship facadeRelationship = new FacadeRelationship();

            InProcess.InProcessRelationship relationship = new InProcess.InProcessRelationship(MapManager);
            relationship.OriginLink = transactionLink;
            relationship.Facade = facadeRelationship;
            relationship.Id = Guid.NewGuid();
            relationship.DomainId = domainId;
            relationship.RootMapId = rootMapId;
            relationship.RelationshipType = relationshipType;
            relationship.OriginalId = originalId;
            relationship.Status = Proxy.LoadState.Full;

            facadeRelationship.BaseRelationship = relationship;

            foreach (KeyValuePair<Proxy.ConnectionType, Proxy.INode> relationshipContext in nodes)
            {
                Proxy.ConnectionSet connection = Proxy.ConnectionSetFactory.Instance.GetConnection(relationshipContext.Value, facadeRelationship, relationshipContext.Key);

                Proxy.INodeManager newRelationshipNodes = relationship.Nodes;
                newRelationshipNodes.Load(connection);

                Proxy.IRelationshipManager nodeRelationships = relationshipContext.Value.Relationships;
                nodeRelationships.Load(connection);
            }

            InProcessRelationships.Add(transactionLink, facadeRelationship);

            return facadeRelationship;
        }
示例#3
0
        public Proxy.IRelationship FindRelationship(ServerObjects.Relationship serviceRelationship)
        {
            Proxy.IRelationship relationship;

            if (ProxyRelationships.ContainsKey(serviceRelationship.RelationshipUid))
            {
                relationship = ProxyRelationships[serviceRelationship.RelationshipUid];

                SoapRelationship soapRelationship = relationship as SoapRelationship;

                /// Not all the relationships that are stored in the RelationshipManager are SoapRelationships, some are FacadeRelationships. In this scenario we want to check if they have an inner SoapRelationship and use that instead.
                if (soapRelationship == null)
                {
                    if (relationship is FacadeRelationship)
                    {
                        FacadeRelationship facadeRelationship = relationship as FacadeRelationship;
                        soapRelationship = facadeRelationship.BaseRelationship as SoapRelationship;
                    }
                }

                if (soapRelationship != null)
                {
                    soapRelationship.UpdateRelationship(serviceRelationship);
                }
            }
            else
            {
                SoapRelationship soapRelationship = new SoapRelationship(MapManager);
                soapRelationship.UpdateRelationship(serviceRelationship);

                ProxyRelationships.Add(soapRelationship.Id, soapRelationship);

                relationship = soapRelationship;
            }

            if (!ServiceRelationships.ContainsKey(serviceRelationship.RelationshipUid))
            {
                ServiceRelationships.Add(serviceRelationship.RelationshipUid, serviceRelationship);
            }

            return(relationship);
        }
示例#4
0
        public void UpgradeFacade(TransactionFramework.ISoapTransactionLink transactionLink, ServerObjects.Relationship serviceRelationship)
        {
            if (InProcessRelationships.ContainsKey(transactionLink))
            {
                FacadeRelationship facadeRelationship = InProcessRelationships[transactionLink];
                InProcess.InProcessRelationship inProcessRelationship = facadeRelationship.BaseRelationship as InProcess.InProcessRelationship;

                if (inProcessRelationship != null)
                {
                    SoapRelationship soapRelationship = new SoapRelationship(inProcessRelationship, serviceRelationship);

                    facadeRelationship.BaseRelationship = soapRelationship;

                    InProcessRelationships.Remove(transactionLink);
                    ProxyRelationships[facadeRelationship.Id] = facadeRelationship;

                    /// TODO: Need to consider a better way to do this. I don't like that there is a need to call this afterwards and maybe it should be done when creating the SoapRelationship. I don't like it because it doesn't have to be done everytime a new SoapRelationship is created e.g. if the SoapNode is created from a Service.RE as opposed to a returned call like here.
                    soapRelationship.ProcessDelayedActions();
                }
            }
        }