コード例 #1
0
 /// <summary>
 /// Creates an interface proxy type that can be used by the WCF host.
 /// </summary>
 /// <param name="interfaceToProxy">The service interface to proxy.</param>
 /// <returns>
 /// A <see cref="System.Type"/> that is a proxy for the interface specified
 /// by <paramref name="interfaceToProxy" /> that will be able to be
 /// hosted by WCF.
 /// </returns>
 /// <remarks>
 /// <para>
 /// This proxy type creation method uses the
 /// <see cref="Autofac.Extras.Multitenant.Wcf.DynamicProxy.ServiceHostInterfaceProxyGenerator"/>
 /// to create the service host proxy type. As this is a very specialized
 /// proxy type, it does not take options like other proxy types.
 /// </para>
 /// </remarks>
 /// <seealso cref="Autofac.Extras.Multitenant.Wcf.DynamicProxy.ServiceHostInterfaceProxyGenerator" />
 public virtual Type CreateWcfProxyType(Type interfaceToProxy)
 {
     if (interfaceToProxy == null)
     {
         throw new ArgumentNullException("interfaceToProxy");
     }
     AssertValidType(interfaceToProxy);
     var generator = new ServiceHostInterfaceProxyGenerator(ModuleScope, interfaceToProxy) { Logger = Logger };
     return generator.GenerateCode(interfaceToProxy, null, ProxyGenerationOptions.Default);
 }
コード例 #2
0
        /// <summary>
        /// Creates an interface proxy type that can be used by the WCF host.
        /// </summary>
        /// <param name="interfaceToProxy">The service interface to proxy.</param>
        /// <returns>
        /// A <see cref="System.Type"/> that is a proxy for the interface specified
        /// by <paramref name="interfaceToProxy" /> that will be able to be
        /// hosted by WCF.
        /// </returns>
        /// <remarks>
        /// <para>
        /// This proxy type creation method uses the
        /// <see cref="Autofac.Extras.Multitenant.Wcf.DynamicProxy.ServiceHostInterfaceProxyGenerator"/>
        /// to create the service host proxy type. As this is a very specialized
        /// proxy type, it does not take options like other proxy types.
        /// </para>
        /// </remarks>
        /// <seealso cref="Autofac.Extras.Multitenant.Wcf.DynamicProxy.ServiceHostInterfaceProxyGenerator" />
        public virtual Type CreateWcfProxyType(Type interfaceToProxy)
        {
            if (interfaceToProxy == null)
            {
                throw new ArgumentNullException("interfaceToProxy");
            }
            AssertValidType(interfaceToProxy);
            var generator = new ServiceHostInterfaceProxyGenerator(ModuleScope, interfaceToProxy)
            {
                Logger = Logger
            };

            return(generator.GenerateCode(interfaceToProxy, null, ProxyGenerationOptions.Default));
        }