示例#1
0
        protected IObject[] GetObjects(ISession session, Composite objectType)
        {
            if (session is IDatabaseSession)
            {
                return session.Extent(objectType);
            }

            var workspaceSess = (IWorkspaceSession)session;
            return workspaceSess.LocalExtent(objectType);
        }
示例#2
0
 public static void SetComposite(this ModelMetadata modelMetadata, Composite value)
 {
     modelMetadata.AdditionalValues[CompositeKey] = value;
 }
示例#3
0
文件: DomainTest.cs 项目: Allors/apps
 protected IObject[] GetObjects(ISession session, Composite objectType)
 {
     return session.Extent(objectType);
 }
示例#4
0
文件: Tree.cs 项目: whesius/allors
 public Tree(Composite composite)
 {
     this.composite = composite;
     this.nodes = new List<TreeNode>();
 }
示例#5
0
        private bool HasCycle(Composite originalSubtype, Interface currentSupertype, HashSet<Interface> supertypes, Dictionary<Composite, List<Inheritance>> inheritancesBySubtype)
        {
            if (originalSubtype is Interface && supertypes.Contains((Interface)originalSubtype))
            {
                return true;
            }

            if (!supertypes.Contains(currentSupertype))
            {
                supertypes.Add(currentSupertype);

                List<Inheritance> currentSuperInheritances;
                if (inheritancesBySubtype.TryGetValue(currentSupertype, out currentSuperInheritances))
                {
                    foreach (var inheritance in currentSuperInheritances)
                    {
                        var newSupertype = inheritance.Supertype;
                        if (newSupertype != null)
                        {
                            if (this.HasCycle(originalSubtype, newSupertype, supertypes, inheritancesBySubtype))
                            {
                                return true;
                            }
                        }
                    }
                }
            }

            return false;
        }
示例#6
0
        private bool HasCycle(Composite subtype, HashSet<Interface> supertypes, Dictionary<Composite, List<Inheritance>> inheritancesBySubtype)
        {
            foreach (var inheritance in inheritancesBySubtype[subtype])
            {
                var supertype = inheritance.Supertype;
                if (supertype != null)
                {
                    if (this.HasCycle(subtype, supertype, supertypes, inheritancesBySubtype))
                    {
                        return true;
                    }
                }
            }

            return false;
        }
示例#7
0
文件: Path.cs 项目: whesius/allors
        private static PropertyType Resolve(Composite composite, string propertyName)
        {
            var lowerCasePropertyName = propertyName.ToLowerInvariant();

            foreach (var roleType in composite.RoleTypes)
            {
                if (roleType.SingularName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    roleType.SingularFullName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    roleType.PluralName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    roleType.PluralFullName.ToLowerInvariant().Equals(lowerCasePropertyName))
                {
                    return roleType;
                }
            }

            foreach (var associationType in composite.AssociationTypes)
            {
                if (associationType.SingularName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    associationType.SingularFullName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    associationType.SingularPropertyName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    associationType.PluralName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    associationType.PluralFullName.ToLowerInvariant().Equals(lowerCasePropertyName) ||
                    associationType.PluralPropertyName.ToLowerInvariant().Equals(lowerCasePropertyName))
                {
                    return associationType;
                }
            }

            return null;
        }
示例#8
0
文件: Path.cs 项目: whesius/allors
 public static bool TryParse(Composite composite, string pathString, out Path path)
 {
     var propertyType = Resolve(composite, pathString);
     path = propertyType == null ? null : new Path(propertyType);
     return path != null;
 }