开发者

How to convert Untiy Configuration from 1.2.* to 2.0.*

In Unity 1.2, I had this text in web.config

      <type type="IRouteRegistry" mapTo="TownHall.Mvc.Routing.TownHallRoutes,TownHall.Mvc">
        <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,Microsoft.Practices.Unity.Configuration">
          <constructor>
            <param name="routes" parameterType="RouteCollection">
              <dependency name="ApplicationRouteCollection" />
            </param>
            <param name="routeHandlerType" parameterType="System.Type">
              <dependency name="RegisterRoutesHandler"/>
            </param>
            <param name="settings" parameterType="IAppSettings">
              <dependency/>
            </param>
          </constructor>
        </typeConfig>
      </type>

I convert to bellow text in Unity 2.0.*

 <register type="IRouteRegistry" mapTo="TownHall.Mvc.Routing.TownHallRoutes, TownHall.Mvc">
   <constructor>
     <param name="routes" type="RouteCollection">
       <dependency name="ApplicationRouteCollection" />
     </param>
     <param name="routeHandlerType" type="System.Type">
       <dependency name="RegisterRoutesHandler" />
     </param>
     <param name="settings" type="IAppSettings">
       <dependency />
     </param>
   </constructor>
 </register>

But it got error

The type name or alias RouteCollection could not be resolved. Please check your >configuration file and verify this type name.

at

       IUnityContainer townhallContainer = new UnityContainer();
       UnityConfigurationSection config = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

       config.Configure(townhallContainer); // I got er开发者_如何转开发ror here

       return townhallContainer;

How do I convert them to Unity 2.0 configuration file ???

Sorry my bad English


Sorry everyone, I've just resolved this problem. The Problem came from type="RouteCollection" and I need delete that text

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜