The simple elegance of Ninject’s Fluent Interface
I am currently working with a serverside stack of ASP.NET MVC WebAPI for RESTful Services. This talks to a BusinessDomain Facade, which uses the UnitOfWork and Repository Pattern. This is all stitched together with Ninject.
Using good architectural practice coupled with Ninject makes it easy to switch the default UnitOfWork class for my project to a specialized version, for one API. See below.
The reason for this code is simple :
I have been rapidly prototyping a rich client application, the server side repository is mocked out as a generic data store. So all my Web API classes delegate on to the default prototyping unit of work. Transitioning away from this UnitofWork to the application specific repository couldn’t be simpler with Ninject. By switching the UnitOfWork that is bound to my UnitOfWork Interface for one specific underlying controller means I have a phased transition from prototype to product.
So many people spend their health gaining wealth, and then have to spend their wealth to regain their health.
A.J. Reb Materi
ASP.NET MVC Web Api, IIS and GZip Compression
One of the interesting options in IIS is the ability to enable GZIP Compression on dynamic resources, such as JSON responses to REST Requests.
Obviously bearing in mind we are talking dynamic resources, then we obviously have to pay the cost of compression, which may mean more processor utilization. So you have to trade this off with an impact on overall server performance.
Anyways, to enable dynamic compression of ASP.NET WebAPI Services with IIS, its just a matter of going into the server settings in IIS and opening the Configuration Editor ( at Server Level ). Proceed to select the httpCompression settings and adding mimeType “application/json; charset=utf-8”
And Voilà there you have it.
To test this code on the client side with the C# HttpClient class, simply initialize your class as follows:
”– you know, I’ve either had a family, a job,
something has always been in the
I’ve sold my house, I’ve found this
place, a large studio, you should see the space and
for the first time in my life I’m going to have
a place and the time to
no baby, if you’re going to create
you’re going to create whether you work
16 hours a day in a coal mine
you’re going to create in a small room with 3 children
while you’re on
you’re going to create with part of your mind and your body blown
you’re going to create blind
you’re going to create with a cat crawling up your
the whole city trembles in earthquake, bombardment,
flood and fire.
baby, air and light and time and space
have nothing to do with it
and don’t create anything
except maybe a longer life to find
Charles Bukowski - AIR AND LIGHT AND TIME AND SPACE
Though leaves are many,
the root is one;
Through all the lying days of my youth
I swayed my leaves and flowers in the sun;
Now I may wither into the truth.
The Coming Of Wisdom With Time