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 操作系统.. ------------------------------------- ------------------------------------- ...
- VMware Workstation 12 Pro 之安装林耐斯优麒麟 X64-UI系统
VMware Workstation 12 Pro 之安装林耐斯优麒麟 X64-UI系统... ------------------------------- -------------------- ...
- BotVS开发基础—2.1 账户、行情、K线、深度
代码 import json def main(): Log("账号信息:", exchange.GetAccount()); # Log("K 线数据:", ...
- html页面不使用缓存的代码
有时候,在我们用动态php页面调用html的时候会出现html缓存现象,所以可以在html头部加入以下代码,html就不会出现缓存了. <meta HTTP-EQUIV="pragma ...
- java web开发时的绝对路径与相对路径
相对路径 不以/开头的路径为相对路径,使用相对路径时的路径为当前访问的文件的父目录,即如果现在访问文件的路径为http://localhost:8080/项目名/目录/文件,那么使用相对路径时路径前缀 ...
- Windows下JNI的使用教程
JNI的使用大致有以下4个步骤: 一.在Java中写native方法 二.用javah命令生成C/C++头文件 三.写对应的C/C++程序实现头文件中声明的方法,并编译成库文件 四.在Java中加载这 ...
- Java架构师系统培训高并发分布式电商实战activemq,netty,nginx,redis dubbo shiro jvm虚拟机视频教程下载
15套java架构师.集群.高可用.高可扩 展.高性能.高并发.性能优化.Spring boot.Redis.ActiveMQ.Nginx.Mycat.Netty.Jvm大型分布 式项目实战视频教程 ...
- 从服务器端获取列和数据动态创建Ext.grid.EditorGridPanel
1.添加列的方法 var addColumn = function(){ this.fields = ''; this.columns = ''; this.addColumns=function(n ...
- (转载)深入Java关键字this的用法的总结
在Java程序设计中经常会见到this的使用,this使得程序设计变得规范.简单.灵活.但是在使用过程中,在不同场 合它的含义并不完全相同,使用不当还会出现错误, 本文对this的几种用法和出现的问题 ...
- Semaphore实现原理分析
synchronized的语义是互斥锁,就是在同一时刻,只有一个线程能获得执行代码的锁.但是现实生活中,有好多的场景,锁不止一把. 比如说,又到了十一假期,买票是重点,必须圈起来.在购票大厅里,有5个 ...