惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Stack Overflow Blog
Stack Overflow Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
爱范儿
爱范儿
WordPress大学
WordPress大学
B
Blog RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
MyScale Blog
MyScale Blog
GbyAI
GbyAI
Martin Fowler
Martin Fowler
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
The Cloudflare Blog
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
I
InfoQ
Google DeepMind News
Google DeepMind News
S
Securelist
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 【当耐特】
Latest news
Latest news
T
Threatpost
量子位
Y
Y Combinator Blog
T
Troy Hunt's Blog
Know Your Adversary
Know Your Adversary
MongoDB | Blog
MongoDB | Blog
罗磊的独立博客
博客园_首页
AWS News Blog
AWS News Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
宝玉的分享
宝玉的分享
Project Zero
Project Zero
V
Visual Studio Blog
F
Fortinet All Blogs
S
Security Affairs
The Register - Security
The Register - Security
G
Google Developers Blog
T
Tenable Blog
L
LINUX DO - 最新话题
The GitHub Blog
The GitHub Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
博客园 - Franky

博客园 - 云龙

win8.1安装出错解决方法之一 vs未能正确加载XX包的解决方法 下载android sdk ubuntu下安装与卸载软件方法 Ubuntu 安装杀毒软件防火墙 Ubuntu 图形处理软件 Ubuntu 下编译Android 源代码 ubuntu 安装配置 JDK7和Android Studio(apt-get方式) ununtu 下安装 Nvidia 显卡驱动 windows 8.1 在硬盘上创建扩展分区 (转)ASP.NET Identity登录原理 - Claims-based认证和OWIN (转)从Membership 到 .NET4.5 之 ASP.NET Identity (转)Asp.Net MVC中身份认证和授权 用JSON数据向已定义列的表格添加数据行 在MVC中动态读取JSON数据创建表格 IIS7.0(虚拟机)发布MVC5程序出现Http403错误的解决方法. 如何避免MVC Model First 设计时添加的DataAnnotation被覆盖掉 移动路由表 cisco路由基于策略的路由选择
Unity4.0配置
云龙 · 2016-06-05 · via 博客园 - 云龙

关于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)

最后在需要的地方调用