Exemple #1
0
        public static void RegisterProxy(this IContainer container, Type fromType, Func <IResolver, object> factory)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            var lifetimeManager = new ProxyLifetimeManager(factory);

            container.Register(lifetimeManager, fromType);
        }
Exemple #2
0
        public static void RegisterProxy(this IContainer container, Type fromType, Type toType, string fromKey = null, string toKey = null)
        {
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            var lifetimeManager = new ProxyLifetimeManager(toType, fromKey);

            container.Register(lifetimeManager, fromType, toKey);
        }