Пример #1
0
        protected override object VisitIEnumerable(IEnumerableCallSite enumerableCallSite, CallSiteFormatterContext argument)
        {
            argument.WriteProperty("itemType", enumerableCallSite.ItemType);
            argument.WriteProperty("size", enumerableCallSite.ServiceCallSites.Length);

            if (enumerableCallSite.ServiceCallSites.Length > 0)
            {
                argument.StartProperty("items");

                CallSiteFormatterContext childContext = argument.StartArray();
                foreach (ServiceCallSite item in enumerableCallSite.ServiceCallSites)
                {
                    childContext.StartArrayItem();
                    VisitCallSite(item, childContext);
                }
                argument.EndArray();
            }
            return(null);
        }
Пример #2
0
        protected override object VisitCallSiteMain(ServiceCallSite callSite, CallSiteFormatterContext argument)
        {
            if (argument.ShouldFormat(callSite))
            {
                CallSiteFormatterContext childContext = argument.StartObject();

                childContext.WriteProperty("serviceType", callSite.ServiceType);
                childContext.WriteProperty("kind", callSite.Kind);
                childContext.WriteProperty("cache", callSite.Cache.Location);

                base.VisitCallSiteMain(callSite, childContext);

                argument.EndObject();
            }
            else
            {
                CallSiteFormatterContext childContext = argument.StartObject();
                childContext.WriteProperty("ref", callSite.ServiceType);
                argument.EndObject();
            }

            return(null);
        }
Пример #3
0
        protected override object VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteFormatterContext argument)
        {
            argument.WriteProperty("implementationType", constructorCallSite.ImplementationType);

            if (constructorCallSite.ParameterCallSites.Length > 0)
            {
                argument.StartProperty("arguments");

                CallSiteFormatterContext childContext = argument.StartArray();
                foreach (ServiceCallSite parameter in constructorCallSite.ParameterCallSites)
                {
                    childContext.StartArrayItem();
                    VisitCallSite(parameter, childContext);
                }
                argument.EndArray();
            }

            return(null);
        }
Пример #4
0
        protected override object VisitConstant(ConstantCallSite constantCallSite, CallSiteFormatterContext argument)
        {
            argument.WriteProperty("value", constantCallSite.DefaultValue ?? "");

            return(null);
        }
Пример #5
0
        protected override object VisitFactory(FactoryCallSite factoryCallSite, CallSiteFormatterContext argument)
        {
            argument.WriteProperty("method", factoryCallSite.Factory.Method);

            return(null);
        }