之前在代码中构造container.RegisterType<IUserService, AspNetMembershipProviderWrapper>(new InjectionConstructor(Membership.Provider));请问在配置文件中怎么样配置?

解决方案 »

  1.   

    <containers>
      <container>
       <type type="命名空间.IUserService, DLL名"
             mapTo="命名空间.AspNetMembershipProviderWrapper, DLL名" >
         <lifetime type ="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
       </type>
      </container>
    </containers>
      

  2.   

    (new InjectionConstructor(Membership.Provider));  
    这句要怎么写呢
      

  3.   

    <containers>
      <container>
       <type type="命名空间.IUserService, DLL名"
             mapTo="命名空间.AspNetMembershipProviderWrapper, DLL名" >
         <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,
                                         Microsoft.Practices.Unity.Configuration"> 
             <constructor>
                  <param name="参数名" parameterType="参数类型">
                    <dependency />
                  </param>
             </constructor>     
         </typeConfig>
       </type>
      </container>
    </containers>
    http://msdn.microsoft.com/en-us/library/ff650027.aspx