예제 #1
0
        public object Diagnostics(
            [FromServices] ConfigurationInstanceHolder configurationInstanceHolder,
            [FromServices] IEnumerable <MySampleMultipleInstance> multipleInstances)
        {
            if (configurationInstanceHolder is null)
            {
                throw new ArgumentNullException(nameof(configurationInstanceHolder));
            }

            if (multipleInstances is null)
            {
                throw new ArgumentNullException(nameof(multipleInstances));
            }

            return(new
            {
                Instances = configurationInstanceHolder !.RegisteredTypes
                            .Select(type => new
                {
                    type.FullName, Instances = configurationInstanceHolder.GetInstances(type).ToArray()
                })
                            .ToArray(),
                multipleInstances
            });
예제 #2
0
 /// <summary>
 /// Gets the list of registered types.
 /// </summary>
 public static IEnumerable <Type> GetRegisteredTypes()
 {
     return(RegisteredTypes.Select(reg => reg.Key));
 }