New Features and changes of Ninject 3.3
Ninject 3.3 beta1 has gone live. This release mainly focus on bug fix and platform update.
Support .NET Standard 2.0
Since version 3.3, Ninject starts to support .net standard 2.0. Microsoft announced .net standard 2.0 at Augest 14th which has more than doubled the set of available APIs. It makes much easier to port Ninject to .net standard 2.0. Previously there are many conditional compilations and even wrong behaviors during 4.0 pilot development. For example ReflectedType is not supported in .NET Standard 1.5. The workaround is to use DeclaringType. However DeclaringType is different with ReflectedType. So in release 3.3, we only support .net standard 2.0 and .net framework 4.5. The only difference is the auto module scanning feature. net framework supports to create and unload AppDomain while .net standard 2.0 doesn't.
Ninject 3.3 also dropped support for .NET 3.5 and Silverlight.
Array/List of concrete classes will return empty if the concrete class is not explictly binded
The is a behavior change. If a concrete class is self bindable, but user didn't bind it explicitly, when request a list of it, it is more naturally to return an empty list rather than a list with one item. This should be a break change. But I think it is a correct move.
Improved cyclical dependencies detection
The cyclical dependencies detection has been improved for open generic types. Check the github issue for details.
Conditional binding is being considered when score constructors
When score constructors, previously, we will look for the one with most bindings matching regardless the binding condition.
consider the below case:
[Fact]
public void UnsatisfiedConditionalShouldBeIngored()
{
kernel.Bind<Barracks>().ToSelf();
kernel.Bind<IWeapon>().To<Sword>();
kernel.Bind<IWarrior>().To<Samurai>().When(_ => false); var barracks = kernel.Get<Barracks>();
barracks.Should().NotBeNull();
barracks.Warrior.Should().BeNull();
barracks.Weapon.Should().NotBeNull();
}
Barracks has 3 constructors, one with IWeapon, one with IWarrior, one with both. It should choose the one with only IWeapn. So please be advised that the condition method will be evaluated twice now.
Singleton / circular dependency
When request a singleton object which has property dependencies (or has OnActivation callback), during creating the dependecies (or executing the callback), the singleton object may have already created. In this case we should return the created singleton object instead of creating a new one.
Check this commit for details.
Other changes
There are some other bug fixes and changes. For example some spelling correction in xml doc comments; start to use Appveyor as CI build server; Start to use CodeCov to track the code coverage; StyleCop compliance.
For the complete change list, please refer to the ReleaseNotes.md and commits.
Happy Injecting!
New Features and changes of Ninject 3.3的更多相关文章
- Using Ninject in a Web Application
http://aidenweb.co.uk/?p=15 Using Ninject in a Web Application I have been meaning to look at Ninjec ...
- C# Note3:大话Ninject
前言 之所以研究Ninject,是因为初入职在开发XX项目的ComponentService部分时用到了它,一下子发现了它的强大.渐渐地发现在项目中,有时会用到优秀的第三方开源库,这些都是前人智慧的结 ...
- Ninject学习(一) - Dependency Injection By Hand
大体上是把官网上的翻译下而已. http://www.ninject.90iogjkdcrorg/wiki.html Dependency Injection By Hand So what's Ni ...
- ASP.NET MVC学前篇之Ninject的初步了解
ASP.NET MVC学前篇之Ninject的初步了解 1.介绍 废话几句,Ninject是一种轻量级的.基础.NET的一个开源IoC框架,在对于MVC框架的学习中会用到IoC框架的,因为这种IoC开 ...
- [ASP.NET MVC 小牛之路]04 - 依赖注入(DI)和Ninject
本人博客已转移至:http://www.exblr.com/liam 为什么需要依赖注入 在[ASP.NET MVC 小牛之路]系列的理解MVC模式文章中,我们提到MVC的一个重要特征是关注点分离( ...
- [ASP.NET MVC 小牛之路]05 - 使用 Ninject
在[ASP.NET MVC 小牛之路]系列上一篇文章(依赖注入(DI)和Ninject)的末尾提到了在ASP.NET MVC中使用Ninject要做的两件事情,续这篇文章之后,本文将用一个实际的示例来 ...
- Specific sleep staging features in EEG
Source: MedScape Overview NREM and REM occur in alternating cycles, each lasting approximately 90-10 ...
- ECMAScript 6 Features 中文版
ECMAScript 6 Features 中文版 如词不达意,欢迎提 PR & issue 采用中英混排的方式进行译制,如不解请查看对应原文 本文档将与原作者的 文档 保持同步更新,欢迎关注 ...
- New Features In SNMPv3 - SNMP Tutorial
30.12 New Features In SNMPv3 We said that version 3 of SNMP represents an evolution that follows and ...
随机推荐
- Ubuntu 发行版的 Linux 操作系统
Ubuntu 发行版的 Linux 操作系统.. ------------------------------------- ------------------------------------- ...
- Win10家庭版重命名Administrator用户文件夹
需要将Windows系统默认的Administrator帐号文件夹改名为我们自定义的名称.. 但是Win10家庭版找不到组策略gpedit.msc 根据微软官方有关Win10各版本操作系统中对于组策略 ...
- javaweb中重定向和请求转发(response.sendRedirect()和request.getRequestDispatcher(rul).forward(request,response)))的区别
先来两张图,方便理解: 可以看出,重定向时,是服务器向游览器重新发送了一个response命令,让游览器再次向url2发送请求,以获取url2的资源 而请求转发时,类似于是服务器自己向自己发了一个跳转 ...
- Oracle DG测试failover和后续恢复报告
Oracle DG测试failover和后续恢复报告 一.概述 二.验证过程: 2.1 A库异常关闭 2.2 B库进行failover切换为新主库 2.3 要求C库成为新主库的备库 2.4 要求A库成 ...
- java通过freemarker导出包含富文本图片的word文档
废话不多说,进入正题! 本文重点在于:对富文本图片的导出(基础的freemarker+word模板导出这里不做详细解说哈) 参考文章:http://www.cnblogs.com/liaofeifig ...
- 原创: rsync软件服务利用ansible实现一键化部署
---恢复内容开始--- 首先创建一个脚本文件 /server/tools/peizhi.sh cat /server/tools/peizhi.sh cat >>/etc/rsyncd ...
- 七字真言解读TCP三次握手
三次握手所谓的"三次握手"即对每次发送的数据量是怎样跟踪进行协商使的发送和接收同步,根据所接收到的数据量而确定的数据确认数及数据发送.接收完毕后何时撤消联系,并建立虚连接. 一.七 ...
- Thinkphp3.2.3框架下封装公共的函数,例如封装CURL函数来获取接口数据
当我们需要在控制层调用相同的封装函数时,写多次相同的函数,显得代码十分的拉杂,不精简: TP框架有一个很好的机制,可以再Common定义一个function.php函数,当我们在控制层调用的时候直接调 ...
- redis info 命令详解
详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt119 Redis Info 命令以一种易于理解和阅读的格式,返回关于 Red ...
- HashMap 底层算法分析
详见: http://blog.yemou.net/article/query/info/tytfjhfascvhzxcytp72 Hash算法HashMap使用Hash算法,所以在解剖HashMap ...