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 ...
随机推荐
- 【Js应用实例】javascript管理cookie
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- JavaScript 学习笔记 - Web Workers
前言 本文仅是 Web Workers 的入门科普文章,不涉及太琐碎的知识点. 我们知道,在 Web Workers 出来之前,JavaScript 是单线程的.即使是 setTimeout 之类的看 ...
- JS字符串转换为JSON的四种方法笔记
1.jQuery插件支持的转换方式: 示例: $.parseJSON( jsonstr ); //jQuery.parseJSON(jsonstr),可以将json字符串转换成json对象 2.浏览 ...
- Tkinter 导入安装包
Tkinter (capitalized) refers to versions <3.0. tkinter (all lowecase) refers to versions ≥3.0
- 环境配置-云服务器jdk与tomcat配置
我所实践的主机是麻花疼云的主机,第一次试用30天,装了个centos6.5,其实已经用商用专用镜像配置好环境了,包括jdk.tomcat等常用的内容,但是我实在是找不到他们安装在哪个目录下了,我就自己 ...
- 数据结构之合并链表STL
#include <iostream> #include <list> using namespace std; int main() { int n, m; while (c ...
- kindeditor上传图片时候,上传成功了,但是页面上却提示失败
今天尝试着kindeditor做一个上传demo,碰到了一个日狗的问题,百度谷歌都没有答案,最后查看源码才发现问题所在,记录一下,福利大众. 碰到问题如下,图片后台明明上传成功了,返回信息也是正确的, ...
- CAP和BASE理论
详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt370 1. CAP理论 2000年7月,加州大学伯克利分校的Eric Bre ...
- 入侵检测工具之RKHunter & AIDE
一.AIDE AIDE全称为(Adevanced Intrusion Detection Environment)是一个入侵检测工具,主要用于检查文件的完整性,审计系统中的工具是否被更改过. AIDE ...
- mpls vpn剩余笔记
将IP地址映射为简单的具有固定长度的标签 用于快速数据包交换 20 3 1 8 在整个转发过程中,交换节点仅根据标记进行转发 标签交换路径(LSP) 多协议标签交换MPLS最初是为了提高转发速度而提出 ...