コード例 #1
0
 public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext)
 {
     return(UserCustomeNodeHelper.GetStatus(smoObject));
 }
コード例 #2
0
 public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
 {
     return(string.Empty);
 }
コード例 #3
0
        /// <summary>
        /// Populates any non-folder nodes such as specific items in the tree.
        /// </summary>
        /// <param name="allChildren">List to which nodes should be added</param>
        /// <param name="parent">Parent the nodes are being added to</param>
        protected virtual void OnExpandPopulateNonFolders(IList <TreeNode> allChildren, TreeNode parent, bool refresh, string name)
        {
            Logger.Write(LogLevel.Verbose, string.Format(CultureInfo.InvariantCulture, "child factory parent :{0}", parent.GetNodePath()));

            if (ChildQuerierTypes == null)
            {
                // This node does not support non-folder children
                return;
            }
            SmoQueryContext context = parent.GetContextAs <SmoQueryContext>();

            Validate.IsNotNull(nameof(context), context);

            var serverValidFor = context.ValidFor;

            if (ShouldFilterNode(parent, serverValidFor))
            {
                return;
            }

            IEnumerable <SmoQuerier> queriers = context.ServiceProvider.GetServices <SmoQuerier>(q => IsCompatibleQuerier(q));
            var filters       = this.Filters.ToList();
            var smoProperties = this.SmoProperties.Where(p => ServerVersionHelper.IsValidFor(serverValidFor, p.ValidFor)).Select(x => x.Name);

            if (!string.IsNullOrEmpty(name))
            {
                filters.Add(new NodeFilter
                {
                    Property = "Name",
                    Type     = typeof(string),
                    Values   = new List <object> {
                        name
                    },
                });
            }
            foreach (var querier in queriers)
            {
                if (!querier.IsValidFor(serverValidFor))
                {
                    continue;
                }
                string propertyFilter = GetProperyFilter(filters, querier.GetType(), serverValidFor);
                try
                {
                    var smoObjectList = querier.Query(context, propertyFilter, refresh, smoProperties).ToList();
                    foreach (var smoObject in smoObjectList)
                    {
                        if (smoObject == null)
                        {
                            Logger.Write(LogLevel.Error, "smoObject should not be null");
                        }
                        TreeNode childNode = CreateChild(parent, smoObject);
                        if (childNode != null && PassesFinalFilters(childNode, smoObject) && !ShouldFilterNode(childNode, serverValidFor))
                        {
                            allChildren.Add(childNode);
                        }
                    }
                }
                catch (Exception ex)
                {
                    string error = string.Format(CultureInfo.InvariantCulture, "Failed getting smo objects. parent:{0} querier: {1} error:{2} inner:{3} stacktrace:{4}",
                                                 parent != null ? parent.GetNodePath() : "", querier.GetType(), ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
                    Logger.Write(LogLevel.Error, error);
                    throw ex;
                }
            }
        }
コード例 #4
0
 public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext)
 {
     return(DatabasesCustomNodeHelper.GetStatus(smoObject, smoContext, CachedSmoProperties));
 }
コード例 #5
0
 public override string GetNodeStatus(object smoObject, SmoQueryContext smoContext)
 {
     return(string.Empty);
 }
コード例 #6
0
 public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
 {
     return(SmoColumnCustomNodeHelper.CalculateCustomLabel(smoObject, smoContext));
 }
コード例 #7
0
 public override string GetNodeSubType(object smoObject, SmoQueryContext smoContext)
 {
     return(ParameterCustomeNodeHelper.GetSubType(smoObject));
 }
コード例 #8
0
 public override string GetNodeCustomName(object smoObject, SmoQueryContext smoContext)
 {
     return(ParameterCustomeNodeHelper.GetCustomLabel(smoObject, smoContext));
 }