zoukankan      html  css  js  c++  java
  • Unity4.0配置

    关于Unity4.0的使用:
    一 安装Unity
      在程序包管理器控制台输入命令:Istall-Pckage unity.mvc
    安装后会在App_Start中生成UnityConfig.cs 和UnityMvcActivator.cs 两个文件,打开UnityConfig.cs这个文件,修改如下
    打开UnityConfig.cs这个文件,修改如下
    在Global.asax中增加UnityWebActivator.Start();
    Web.comfig:在<configuration></configuration>中加入
      <configSections>
        <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Microsoft.Practices.Unity.Configuration"/>
      </configSections>
    View Code

    然后配置:

      <unity xmlns="http://schemas.microsoft.com/practices/2010/unity" >
        
        <!--版本-->
        <assembly name="LongIBLL"/>
        <assembly name="LongBLL"/>
        <assembly name="LongIDAL"/>
        <assembly name="LongDAL"/>
        
        <!--命名空间-->
        <namespace name="LongIBLL"/>
        <namespace name="LongBLL"/>
        <namespace name ="LongIDAL"/>
        <namespace name ="LongDAL"/>
        <container>
          
          <!--IBLL映射BLL类-->
          <register type="ILongRolesService"                             mapTo="LongRolesService"/>
          <register type="ILongManagersService"                          mapTo="LongManagersService"/>
          <register type="ILongNewsService"                              mapTo="LongNewsService"/>
          <register type="ILongModulesService"                           mapTo="LongModulesService"/>
          <register type="ILongPermissionModulesService"                 mapTo="LongPermissionModulesService"/>
          <register type="ILongPermissionService"                        mapTo="LongPermissionService"/>
          
          <!--IBLL<T>映射BLL类<T> 泛型注入-->
          <register type="IBaseService[]"              mapTo="LongBaseService[]"/>
    
          <!-- IDAL映射DAL-->
          <register type="ILongRolesRepository"                          mapTo="LongRolesRepository"/>
          <register type="ILongManagersRepository"                       mapTo="LongManagersRepository"/>
          <register type="ILongNewsRepository"                           mapTo="LongNewsRepository"/>
          <register type="ILongModulesRepository"                        mapTo="LongModulesRepository"/>
          <register type="ILongPermissionModulesRepository"              mapTo="LongPermissionModulesRepository"/>
          <register type="ILongPermissionRepository"                     mapTo="LongPermissionRepository"/>
    
          <!-- IDAL<T>映射DAL<T>泛型注入-->
          <register type="IBaseRepository[]"           mapTo="LongBaseRepository[]"/>
        </container>
      </unity> 
    Unity注册配置(web.config)

    最后在需要的地方调用

  • 相关阅读:
    PackageManagerService.java 构造函数的 分析
    如何把APK应用装到只读ROM
    对apk包进行odex优化的目的
    如何把APK应用装到只读ROM
    php学习笔记面向对象中[接口]与[多态性]的应用
    php学习笔记[PHP面向对象的程序设计]
    PHP学习之路(二)让我们开始环境搭建(Windows篇)
    php设计模式 Command(命令模式)
    php数组指针探究
    yii框架学习笔记
  • 原文地址:https://www.cnblogs.com/fcu3dx/p/5559975.html
Copyright © 2011-2022 走看看