Archive

Posts Tagged ‘Ninject’

Ninject.Extensions.Factory introduction

December 31st, 2011
remo.gloor

The new release of Ninject 3.0 comes with a new extension that adds support for factories to Ninject. It supports factory interfaces, Func and Lazy. In this blog post I will explain how they are used.

Why using factories?
The recommended way to use IoC containers is that the composition root of the application is the only place where the container is accessed. Unfortunately many application can’t create everything at once during the application start or at the beginning of a web/wcf request because not everything is known at this moment. Therefore these applications need a way to create new instances using the kernel at a later point. Preferably we want to do this without introducing a reference to the container. This is where factories come into play. Instead of injecting the kernel into classes that need to create new instances we inject a factory. This factory is responsible to create the new instances using the kernel. There are two ways to implement such a factory: A factory interface and as a Func or Lazy.
read more

 

.NET , , ,

New Features and changes of Ninject 3.0

December 30th, 2011
remo.gloor

Ninject 3.0 release candidate has gone live. This release introduces some new feature and some changes in its behavior. This blog post will give you detailed information what has changed. It covers mainly Ninject core. Other blog posts that describe the changes and the new extensions will follow soon.
read more

 

.NET , ,

Why I like Ninject for Acceptance Testing (.NET Dependency Injection Container)

August 22nd, 2011
Urs Enzler

Lately, I wrote quite a lot of acceptance tests. I simulate that the application is started-up and perform all features requested by our customer to make sure that they work as expected. In order to make these tests fast so that they can be run on every commit to the version control system, I simulate all interaction with the environment of the application: views, database, file system, registry, share point and so on.

To get the most out of these acceptance tests, I want to fake as little as possible. And here comes the Rebind feature of Ninject into play. I can bootstrap the application as in production and then replace all components interacting with the environment by simple calls to Rebind.

read more

 

.NET, Why I like ... , ,

Ninject constructor selection preview

May 28th, 2011
remo.gloor

Ninject 2.4 will introduce the ability to configure which constructor shall be used and to configure constructor arguments without having to use magic strings to define for which argument. In this post I will give a preview on how this works.

read more

 

.NET, Architecture ,

Ninject Nuget packages updated to Nuget 1.3

May 7th, 2011
remo.gloor

Recently we have updated all Ninject Nuget packages to Nuget 1.3. In order to use them you have to update your client to 1.3 as well. This update brought a few improvements:

read more

 

.NET , ,

Building Ninject / Ninject Extensions Without Git

March 19th, 2011
Urs Enzler

We received the following question about building Ninject:

I’ve downloaded the source files for both context extensions and namedscopes (Ninject) and have followed the instructions in "how to build.txt" exactly, but I cannot get either NAnt script to build. I keep getting an error from git saying
"get-git-revision:
[exec] fatal: Not a git repository (or any of the parent directories): .git
BUILD FAILED – 0 non-fatal error(s), 1 warning(s)"
what gives? what do I not know to do?
Thank you for taking a moment to educate me. I have googled far and wide and can’t seem to find any help with this error. Note: I’ve never used git, I don’t have a git repository, I don’t have a github account. What dependency do I need to get started?

Ninject build files assume that you are running them inside of a Git repository. The need the Git repository to determine the version to be used for the built assemblies.

There are three solutions to this problem:

  1. Install Git, clone the repository and then run the build script
  2. Change the build script so that a hard-coded version is used by removing the Git related parts and defining the version directly
  3. Build within Visual Studio
 

.NET, Ask a geek

Ninject 2.2.1.0 and Ninject.MVC3 2.2.1.0 released

March 1st, 2011
remo.gloor

I just released Ninject 2.2.1.0 and Ninject.MVC3 2.2.1.0. Both are bugfix releases. In this Blogpost I’ll explain if you have to update and what changes you need to do in case you are using th NuGet version of Ninject.MVC3.
read more

 

.NET, Announcement, Architecture , , ,

Ninject.MVC3 and Ninject.Web.MVC3 merged to one package

February 22nd, 2011
remo.gloor

With Ninject.MVC3 2.2.0.3 available from NuGet Ninject.MVC3 and Ninject.Web.MVC3 got merged into one project providing the advantage or both.
read more

 

.NET , , , ,

Dependency Injection with Windows Workflow Foundation 4 advanced

December 10th, 2010
Daniel Marbach

In this follow up post I try to tackle the more advanced stuff which is possible with the new ninject extension for Windows Workflow Foundation. The goal is to show the following topics:

  • Hooking into the injection chain
  • Possible side effects
  • Changing the extensions behavior
  • Download the extension

read more

 

.NET , ,

Dependency Injection with Windows Workflow Foundation 4 an answer

December 9th, 2010
Daniel Marbach

In my last post I raised the following questions:

  • How do you inject dependencies into activities without having to declare the dependencies as input arguments?
  • How do you build up extensions using DI mechanism?
  • How do you unit test components which host workflow applications or workflow invokers without actually invoking a real workflow?

In this follow up post I try to answer these questions.

read more

 

.NET , ,