示例#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));
        }
示例#2
0
文件: Not.cs 项目: lulzzz/allors2
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new NotAssociationContainedInExtent(this.extent, association, containingExtent);
     return(this);
 }
示例#3
0
文件: Not.cs 项目: lulzzz/allors2
 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;
 }
        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;
        }
        internal RoleManyContainedInExtent(ExtentFiltered extent, IRoleType roleType, Allors.Extent containingExtent)
        {
            extent.CheckForRoleType(roleType);
            PredicateAssertions.ValidateRoleContainedIn(roleType, containingExtent);

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

            this.associationType = associationType;
            this.containingExtent = containingExtent;
        }
示例#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);
        }
示例#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);
        }
示例#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);
                    }
                }
            }
        }
示例#13
0
 public void Build(Allors.Extent extent)
 {
     extent.AddSort(RoleType, this.Descending ? SortDirection.Descending : SortDirection.Ascending);
 }
示例#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;
 }
示例#15
0
 public Allors.Extent Except(Allors.Extent firstOperand, Allors.Extent secondOperand) => new ExtentOperation(((Extent)firstOperand).ContainedInExtent, ((Extent)secondOperand).ContainedInExtent, ExtentOperations.Except);
示例#16
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.predicates.Add(new AssociationContainedInExtent(this.extent, association, containingExtent));
     this.extent.Invalidate();
     return(this);
 }
示例#17
0
 public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new RoleContainedInExtent(this.Extent, role, containingExtent));
     return(this);
 }
示例#18
0
文件: Session.cs 项目: lulzzz/allors2
 public Allors.Extent Intersect(Allors.Extent firstOperand, Allors.Extent secondOperand)
 {
     return(new ExtentOperation(((Extent)firstOperand).ContainedInExtent, ((Extent)secondOperand).ContainedInExtent, ExtentOperations.Intersect));
 }
示例#19
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new AssociationContainedInExtent(this.Extent, association, containingExtent));
     return(this);
 }
 public AssociationContainedInExtent(ExtentFiltered extent, IAssociationType association, Allors.Extent inExtent)
 {
     extent.CheckAssociation(association);
     CompositePredicateAssertions.AssertAssociationContainedIn(association, inExtent);
     this.association = association;
     this.inExtent    = ((Extent)inExtent).ContainedInExtent;
 }