public void Register(Type type)
        {
            var con = type.GetCustomAttribute <ConfigurationAttribute>();

            if (con == null)
            {
                return;
            }

            if (con.Profile != null)
            {
                if (!_profileMatcher.Matches(con.Profile))
                {
                    return;
                }
            }

            var instance = _instanceFactory.CreateFor(type.GetTypeInfo());

            if (instance is IModule module)
            {
                _containerBuilder.RegisterModule(module);
            }

            foreach (var method in type.GetRuntimeMethods().Where(it => !it.IsStatic))
            {
                RegisterMethod(method, instance);
            }
        }
Exemple #2
0
 public static T CreateFor <T>(this IObjectFactory objectFactory)
 {
     return((T)objectFactory.CreateFor(typeof(T).GetTypeInfo()));
 }