Ejemplo n.º 1
0
        public virtual Allors.Extent Intersect(Allors.Extent firstOperand, Allors.Extent secondOperand)
        {
            var firstExtent  = firstOperand as Extent ?? ((ExtentSwitch)firstOperand).Extent;
            var secondExtent = secondOperand as Extent ?? ((ExtentSwitch)secondOperand).Extent;

            return(new ExtentOperation(this, firstExtent, secondExtent, ExtentOperationType.Intersect));
        }
Ejemplo n.º 2
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new NotAssociationContainedInExtent(this.extent, association, containingExtent);
     return(this);
 }
Ejemplo n.º 3
0
 public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new RoleContainedInExtent(this.extent, role, containingExtent);
     return(this);
 }
 internal RoleContainedInExtent(ExtentFiltered extent, IRoleType role, Allors.Extent inExtent)
 {
     extent.CheckRole(role);
     PredicateAssertions.ValidateRoleContainedIn(role, inExtent);
     this.role     = role;
     this.inExtent = ((Extent)inExtent).ContainedInExtent;
 }
Ejemplo n.º 5
0
        internal AssociationContainedInExtent(ExtentFiltered extent, IAssociationType associationType, Allors.Extent containingExtent)
        {
            extent.CheckForAssociationType(associationType);
            PredicateAssertions.AssertAssociationContainedIn(associationType, containingExtent);

            this.associationType  = associationType;
            this.containingExtent = containingExtent;
        }
        internal RoleOneContainedInExtent(ExtentFiltered extent, IRoleType roleType, Allors.Extent containingExtent)
        {
            extent.CheckForRoleType(roleType);
            PredicateAssertions.ValidateRoleContainedIn(roleType, containingExtent);

            this.roleType         = roleType;
            this.containingExtent = containingExtent;
        }
Ejemplo n.º 7
0
        internal RoleManyContainedInExtent(ExtentFiltered extent, IRoleType roleType, Allors.Extent containingExtent)
        {
            extent.CheckForRoleType(roleType);
            PredicateAssertions.ValidateRoleContainedIn(roleType, containingExtent);

            this.roleType = roleType;
            this.containingExtent = containingExtent;
        }
Ejemplo n.º 8
0
 internal void CopyToConnected(Allors.Extent connectedExtent)
 {
     connectedExtent.AddSort(this.roleType, this.direction);
     if (this.subSorter != null)
     {
         this.subSorter.CopyToConnected(connectedExtent);
     }
 }
Ejemplo n.º 9
0
        internal AssociationContainedInExtent(ExtentFiltered extent, IAssociationType associationType, Allors.Extent containingExtent)
        {
            extent.CheckForAssociationType(associationType);
            PredicateAssertions.AssertAssociationContainedIn(associationType, containingExtent);

            this.associationType = associationType;
            this.containingExtent = containingExtent;
        }
Ejemplo n.º 10
0
        public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
        {
            if (role.IsMany)
            {
                this.Filters.Add(new RoleManyContainedInExtent(this.extent, role, containingExtent));
            }
            else
            {
                this.Filters.Add(new RoleOneContainedInExtent(this.extent, role, containingExtent));
            }

            this.extent.Invalidate();
            return(this);
        }
Ejemplo n.º 11
0
        public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
        {
            this.CheckUnarity();
            if (role.IsMany)
            {
                this.predicate = new RoleManyContainedInExtent(this.extent, role, containingExtent);
            }
            else
            {
                this.predicate = new RoleOneContainedInExtent(this.extent, role, containingExtent);
            }

            this.extent.Invalidate();
            return(this);
        }
Ejemplo n.º 12
0
        public virtual void SetCompositeRoles(IRelationType relationType, Allors.Extent roleObjects)
        {
            if (roleObjects == null || roleObjects.Count == 0)
            {
                this.RemoveCompositeRoles(relationType);
            }
            else
            {
                this.AssertExist();
                var roleType = relationType.RoleType;

                // TODO: use CompositeRoles
                var previousRoles = new List <long>(this.Roles.GetCompositeRoles(roleType));
                var newRoles      = new HashSet <long>();

                foreach (IObject roleObject in roleObjects)
                {
                    if (roleObject != null)
                    {
                        RoleAssertions.CompositeRolesChecks(this, roleType, roleObject);
                        var role = (Strategy)roleObject.Strategy;

                        if (!previousRoles.Contains(role.ObjectId))
                        {
                            this.Roles.AddCompositeRole(roleType, role);
                        }

                        newRoles.Add(role.ObjectId);
                    }
                }

                foreach (var previousRole in previousRoles)
                {
                    if (!newRoles.Contains(previousRole))
                    {
                        this.Roles.RemoveCompositeRole(roleType, this.SqlSession.GetOrCreateAssociationForExistingObject(previousRole).Strategy);
                    }
                }
            }
        }
Ejemplo n.º 13
0
 public void Build(Allors.Extent extent)
 {
     extent.AddSort(RoleType, this.Descending ? SortDirection.Descending : SortDirection.Ascending);
 }
Ejemplo n.º 14
0
 public AllorsPredicateRoleInExtentSql(AllorsExtentFilteredSql extent, IRoleType role, Allors.Extent inExtent)
 {
     extent.CheckRole(role);
     PredicateAssertions.ValidateRoleContainedIn(role, inExtent);
     this.role     = role;
     this.inExtent = (AllorsExtentSql)inExtent;
 }
Ejemplo n.º 15
0
 public Allors.Extent Except(Allors.Extent firstOperand, Allors.Extent secondOperand) => new ExtentOperation(((Extent)firstOperand).ContainedInExtent, ((Extent)secondOperand).ContainedInExtent, ExtentOperations.Except);
Ejemplo n.º 16
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.predicates.Add(new AssociationContainedInExtent(this.extent, association, containingExtent));
     this.extent.Invalidate();
     return(this);
 }
Ejemplo n.º 17
0
 public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new RoleContainedInExtent(this.Extent, role, containingExtent));
     return(this);
 }
Ejemplo n.º 18
0
 public Allors.Extent Intersect(Allors.Extent firstOperand, Allors.Extent secondOperand)
 {
     return(new ExtentOperation(((Extent)firstOperand).ContainedInExtent, ((Extent)secondOperand).ContainedInExtent, ExtentOperations.Intersect));
 }
Ejemplo n.º 19
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new AssociationContainedInExtent(this.Extent, association, containingExtent));
     return(this);
 }
Ejemplo n.º 20
0
 public AssociationContainedInExtent(ExtentFiltered extent, IAssociationType association, Allors.Extent inExtent)
 {
     extent.CheckAssociation(association);
     CompositePredicateAssertions.AssertAssociationContainedIn(association, inExtent);
     this.association = association;
     this.inExtent    = ((Extent)inExtent).ContainedInExtent;
 }