예제 #1
0
        public List <Domain.Entity> QueryRelated(Guid entityid, RelationShipType type, int cascadeLinkMask = -1)
        {
            var datas = _entityRepository.QueryRelated(entityid, type).ToList();

            WrapLocalizedLabel(datas);
            return(datas);
        }
예제 #2
0
        /// <summary>
        /// 查询相关实体
        /// </summary>
        /// <param name="entityid"></param>
        /// <returns></returns>
        public IEnumerable <Domain.Entity> QueryRelated(Guid entityid, RelationShipType type, int cascadeLinkMask = -1)
        {
            Sql s = Sql.Builder.Append("SELECT * FROM Entity ");

            if (type == RelationShipType.ManyToMany || type == RelationShipType.ManyToOne)
            {
                if (cascadeLinkMask > 0)
                {
                    s.Append("WHERE EntityId IN (SELECT ReferencedEntityId FROM RelationShip WHERE ReferencingEntityId = @0 AND CascadeLinkMask = @1)", entityid, cascadeLinkMask);
                }
                else
                {
                    s.Append("WHERE EntityId IN (SELECT ReferencedEntityId FROM RelationShip WHERE ReferencingEntityId = @0)", entityid);
                }
            }
            else if (type == RelationShipType.OneToOne || type == RelationShipType.OneToMany)
            {
                if (cascadeLinkMask > 0)
                {
                    s.Append("WHERE EntityId IN (SELECT ReferencingEntityId FROM RelationShip WHERE ReferencedEntityId = @0 AND CascadeLinkMask = @1)", entityid, cascadeLinkMask);
                }
                else
                {
                    s.Append("WHERE EntityId IN (SELECT ReferencingEntityId FROM RelationShip WHERE ReferencedEntityId = @0)", entityid);
                }
            }

            return(Database.Query <Domain.Entity>(s));
        }
예제 #3
0
 public WorkItemNameValueRelation(string name, string value, RelationShipType relationType)
 {
     m_name     = name;
     Value      = value;
     m_relation = m_relationTypes[(int)relationType];
     m_dataType = QueryDataType.String;
 }
예제 #4
0
 public XformParser(string matchString, string changeToString, RelationShipType Type, string Name)
     : base(Type, Name)
 {
     this.Matchstring  = matchString;
     this.Changestring = changeToString;
 }
예제 #5
0
        /// <summary>
        /// Constructs the relationobject and guarantees that the component objects exist in the hash table.
        /// </summary>
        /// <param name="CompleteFileName">Name of the Dependent Element (calling or including or Linking out to... )</param>
        /// <param name="ReferenceFileName">Name of the Required Element (called, created, loaded, or instantiated)</param>
        /// <param name="Type">The type of reference</param>
        /// <returns>Elementrelationship with object pointers to elements</returns>
        /// Note : Elements can include Absolute filenames (which must be unique) or ClassIDs (similarly unique) or URLS (similarly unique)
        /// While building the list of elements, Put new Elements into tmpElements to avoid issues with Iterator Disruption
        ElementRelationship IResolver.ResolveReference(string CompleteFileName, string ReferenceFileName, RelationShipType Type)
        {
            CompleteFileName  = CompleteFileName.ToLower();
            ReferenceFileName = ReferenceFileName.ToLower();
            ElementRelationship retval = new ElementRelationship();

            retval.Dependent = this.Elements[CompleteFileName];
            retval.Relation  = Type;

            if (Type == RelationShipType.RelationCOM)
            {
                if (BasicResolve(retval, ReferenceFileName))
                {
                    System.Console.Out.WriteLine("Unknown COM supporter: " + ReferenceFileName);
                }
                retval.Supporter.ElementType = ElementType.COMobject;

                return(retval);
            } // End COM relation

            if (Type == RelationShipType.RelationLink)
            { // Must handle Http:// , or relative files (my.css, my.html, /subdir/subsubdir/my.html, ~/Food/my.aspx.
                if (ReferenceFileName.IndexOf("://") >= 0)
                {
                    // it's an HTTP tag.
                    if (this.Elements.ContainsKey(ReferenceFileName))
                    {
                        retval.Supporter = Elements[ReferenceFileName];
                        return(retval);
                    }
                    else if (this.tmpElements.ContainsKey(ReferenceFileName))
                    {
                        retval.Supporter = tmpElements[ReferenceFileName];
                        return(retval);
                    }
                    else
                    {
                    }
                }
            }
            if (Type == RelationShipType.RelationInclude)
            {
                // have to make sure that paths are appropriately combined.
                // Given c:\p1\p2\p3\p4\source.txt and ..\..\inc\foo\myfile.txt give :

                if (ReferenceFileName.Contains("/"))
                {
                    ReferenceFileName = ReferenceFileName.Replace("/", "\\");
                }
                string b = CompleteFileName.Remove(CompleteFileName.Length - Path.GetFileName(CompleteFileName).Length);
                string c = Path.GetFullPath(RootFolderName + ReferenceFileName).ToLower();
                string a = Path.GetFullPath(b + ReferenceFileName).ToLower();

                if (this.Elements.ContainsKey(a))
                {
                    retval.Supporter = this.Elements[a];
                    return(retval);
                }
                else if (this.Elements.ContainsKey(c))
                {
                    retval.Supporter = this.Elements[c];
                    return(retval);
                }
                else if (this.tmpElements.ContainsKey(a))
                {
                    retval.Supporter = this.tmpElements[a];
                    return(retval);
                }
                System.Console.Out.WriteLine("Unknown File supporter: " + a);
                ProgramElement R = new RumpElement(a);
                R.ElementType = ElementType.BinaryFile;
                tmpElements.Add(a, R);
                retval.Supporter = R;
                return(retval);
            }

            return(retval);
        }
예제 #6
0
 public RegexParser(string matchstring, RelationShipType Type, string Name) : base(Type, Name)
 {
     this.RegexString = matchstring;
 }
예제 #7
0
 public ParseFeature(RelationShipType t, string n)
 {
     Type = t;
     Name = n;
 }
예제 #8
0
 public HTMLFormParser(RelationShipType Type, string Name)
     : base(Type, Name)
 {
 }