public override ITypeDefinition[] GetTypeDefinitions()
        {
            var typeDefinitions = new ITypeDefinition[0];

            foreach (var type in Assembly.GetTypes().Subset(x => x.IsClass))
            {
                DynamicProxyInjectableAttribute attribute;
                if (Reflector.TryGetCustomAttribute(type, x => x.GetType().Equals(typeof(DynamicProxyInjectableAttribute)), out attribute))
                {
                    var proxyType = DependencyInjector.GetObject <IDynamicProxyGenerator>().CreateProxyType(type);
                    if (proxyType == null)
                    {
                        continue;
                    }

                    typeDefinitions = typeDefinitions.Append(new ITypeDefinition[]
                    {
                        new TypeDefinitionBase(proxyType, attribute.Inference, attribute.Singleton, attribute.Priority, this),
                        new TypeDefinitionBase(type, null, attribute.Singleton, attribute.Priority, this),
                    });
                }
            }

            return(typeDefinitions);
        }
Example #2
0
        public virtual ITypeDefinition[] GetTypeDefinitions()
        {
            var typeDefinitions = new ITypeDefinition[0];

            foreach (var type in Assembly.GetTypes().Subset(x => x.IsClass))
            {
                TAttribute attribute;
                if (Reflector.TryGetCustomAttribute(type, x => x.GetType() == typeof(TAttribute), out attribute))
                {
                    typeDefinitions = typeDefinitions.Append(new TypeDefinitionBase(type, attribute.Inference, attribute.Singleton, attribute.Priority, this));
                }
            }

            return(typeDefinitions);
        }
Example #3
0
        public override ITypeDefinition[] GetTypeDefinitions()
        {
            var typeDefinitions = new ITypeDefinition[0];

            foreach (var type in Assembly.GetTypes().Subset(x => x.IsClass))
            {
                RestServiceInjectableAttribute attribute;
                if (Reflector.TryGetCustomAttribute(type, x => x.GetType().Equals(typeof(RestServiceInjectableAttribute)), out attribute))
                {
                    typeDefinitions = typeDefinitions.Append(new RestServiceTypeDefinition(type, attribute.Inference, attribute.Singleton, attribute.Priority, this, attribute.ServiceName));
                }
            }

            return(typeDefinitions);
        }
        public override ITypeDefinition[] GetTypeDefinitions()
        {
            var typeDefinitions = new ITypeDefinition[0];

            foreach (var type in Assembly.GetTypes().Subset(x => x.IsClass))
            {
                WebSocketInjectableAttribute attribute;
                if (Reflector.TryGetCustomAttribute(type, x => x.GetType().Equals(typeof(WebSocketInjectableAttribute)), out attribute))
                {
                    typeDefinitions = typeDefinitions.Append(new WebSocketTypeDefinition(type, attribute.ServiceName));
                }
            }

            return(typeDefinitions);
        }