示例#1
0
        private void AddConnection(ConnectionDetail con)
        {
            if (!_dataSources.ContainsKey(con.ConnectionName))
            {
                var metadata = new SharedMetadataCache(con, GetNewServiceClient(con));

                _dataSources[con.ConnectionName] = new DataSource
                {
                    ConnectionDetail = con,
                    Connection       = GetNewServiceClient(con),
                    Metadata         = metadata,
                    TableSizeCache   = new TableSizeCache(GetNewServiceClient(con), metadata),
                    Name             = con.ConnectionName
                };
            }

            // Start loading the entity list in the background
            EntityCache.TryGetEntities(con.MetadataCacheLoader, GetNewServiceClient(con), out _);
        }
示例#2
0
        private TreeNode[] LoadEntities(TreeNode parent)
        {
            var metadata = EntityCache.GetEntities(GetService(parent).ServiceClient);

            return(metadata
                   .OrderBy(e => e.LogicalName)
                   .Select(e =>
            {
                var node = new TreeNode(e.LogicalName);
                node.Tag = e;
                SetIcon(node, "Entity");
                var attrsNode = node.Nodes.Add("Attributes");
                SetIcon(attrsNode, "Folder");
                AddVirtualChildNodes(attrsNode, LoadAttributes);
                var relsNode = node.Nodes.Add("Relationships");
                SetIcon(relsNode, "Folder");
                AddVirtualChildNodes(relsNode, LoadRelationships);
                return node;
            })
                   .ToArray());
        }