In this previous post you saw how i used an IDependencyResolver in combination with an IUnityContainer to created a loosely coupled application. But there is still one dependency that i want to cut and that is the url that is used to navigate. Normally if we want to navigate to the Index action of our HomeController we use something like this in the url: http://localhost/Home/IndexThat is an dependency that i want to cut, because we ask to use a controller of type “HomeController”.What i want to do is to navigate through interfaces, http://localhost/IHome/Index...
2011-09-10
ASP .NET MVC and Unity: Navigating through Interfaces
Posted by
Kenny Tordeur
,
at
Saturday, September 10, 2011

2011-05-10
ASP.NET MVC: Where is the ClientID?
Posted by
Kenny Tordeur
,
at
Tuesday, May 10, 2011
For those who are used to program in ASP.NET know this scenario. You have a textbox and you want to do some custom validation in Javascript. You have to be able to access the textbox from the Javascript. The first thing you need to know is the Id for that textbox. You can’t hard code it, because you are not sure how ASP.NET will generate the Id. If the control exists in an INamingContainer, the INamingContainer will add some prefix to the Id of the control. That is where the ClientID property comes to the rescue. This property contains the Id that will be used in HTML. Take a look at this example....
2011-05-03
ASP.NET MVC 3 and Unity using an IDependencyResolver
Posted by
Kenny Tordeur
,
at
Tuesday, May 03, 2011
In this post i used a custom ControllerFactory for dependency injection. I created a custom ControllerFactory where i overrided the GetControllerInstance method. In this method i used the UnityContainer for creating instances of the requested controller. In ASP.NET MVC 3 their is some build in abstraction for doing dependency injection ( IDependencyResolver ). I will change the example used in this post to use the IDependencyResolver. the IDependencyResolver The IDependencyResolver is a fairly easy interface. It contains only 2 methods: object GetService...
2011-04-23
ASP.NET MVC and Unity
Posted by
Kenny Tordeur
,
at
Saturday, April 23, 2011
What is Unity? The Unity Application Block (Unity) is a lightweight extensible dependency injection container with support for constructor, property, and method call injection. Dependency injection is used to create loosely coupled applications. These kind of applications are easier to maintain and easier to test. What do we want to achieve? We want to make our controllers loosely coupled and break any hard dependencies it has. Every object/resource that our controller needs, has to be automatically populated and correctly initiated by Unity. The Asp.net...
2011-04-06
NHibernate in combination with a webservice
Posted by
Kenny Tordeur
,
at
Wednesday, April 06, 2011
In this post i ‘ill try to explain how you can make NHibernate interact with a webservice to fill in a certain object. Current situation This is the current situation that we have. We have a webservice called “Marial State service”. This service is responsible for all marial states available. This service has only 2 methods: GetAll() Gives all the available marial states GetById(Int32 id) Gives a specific marial state by it’s id The client is an application that has it’s own database and uses NHibernate as ORM. The client is responsible...
Subscribe to:
Posts (Atom)