.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

what is unity in dot net

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
what is unity of asp.net framework lib. how to use it.what is the benifit of using this

View Complete Post

More Related Resource Links

Unity - Inject array



I have the following in the config file...

container.RegisterType<ProductInstanceValidatorBase, CartItemStockValidator>();
container.RegisterType<ProductInstanceValidatorBase, MonthlyCartItemValidator>();

..constructor like so...

 public CartValidator(ProductInstanceValidatorBase[] validators)
   this.validators = validators;

...I call the following but the array is empty...


Any ideas?

Cheers, WT.



How to maintain a Unity container reference in WCF


I'm configuring validation application block from Enterprise Library 5 to use validation rules from the web.config file over a WCF call.

The problem is as new calls to the WCF service occur, validation application block is spending a considerable amount of time reading the validation configuration before validating. So my first call to the service which checks if a certain username is available to use (this method also does validation on the username before checking database) take a long time, but every call after that is pretty much instant. Then when I press F5 in my browser and try again, it takes a very long time to setup (read the config validation rules) again.

I read in the Developers guide to Ent Lib 5 that I should maintain a reference to the default Unity container that is setup and use this container to resolve the references. It suggests that I should use a custom extension to the InstanceContext to achieve this but does not give any examples.

How do I do this? Does anyone have examples? I am thinking holding onto a reference to the Unity container could solve the initial speed issues of hitting the service for the first time.

I should mention that I

WCF (REST) and Unity - Cache Doesn't Get Cleaned Up


Hi Folks!

I have following issue with my WCF (REST) service that uses the Unity framework for IOC / DI:

I implemented a service (.svc) that has a reference / dependency to an object that handles the business logic (different assembly) which does also has dependency to the data access 'layer' which actually is a class in a separate assembly.

From the test client I request data from the service as following:

using (WebChannelFactory<IFundService> wcf = new WebChannelFactory<IFundService>("HttpFundServiceEndPoint"))
                IFundService fsvc = wcf.CreateChannel();
                SingleValue sv1 = fsvc.GetValue("Avalon", "CommitmentsTransaction", DateTime.Now);
                SingleValue sv2 = fsvc.GetValue("Avalon", "CommitmentsTransaction", DateTime.Now);


As you can see I do the same call twice with the result that t

Try implement Unity using MVC and Entity FrameWork


First it's my first project using MVC and EF and IOC

I read some articles and try to implement in my project but the project fail.

I write document with all my steps till the error.


How can I resolve this error to make this work?


WCF Rest service Dependecy injection with Unity and EF4 CodeFirst

The article WCF Rest service Dependecy injection with Unity and EF4 CodeFirst was added by ben levy on Monday, March 21, 2011.

Assuming you already have your domain model and repositories implemented and unity wired (if you are missing this part, let me know and i'll add the full stack on a blog), traditionally being consumed by a asp.net MVC3 application, I have added a

Microsoft Unity



Do we have a simple link on microsoft unity other than the above mentioned?



Unity container works within Asp.net project but not within class library it calls.


I have a solution with an asp.net project and several class libraries.  I am using Unity 2.0 in all the projects.  Unity 2.0 seems to work within the HelpfulQuiz web asp.net project, but not within the HelpfulQuizCore class library it utilizes.  I've spent several days trying to figure this out and would appreciate your kind assistance.  Here is the error:


Server Error in '/' Application.

The current type, HelpfulQuizCore.Core.IPictureRepository, is an interface and cannot be constructed. Are you missing a type mapping?

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The current type, HelpfulQuizCore.Core.IPictureRepository, is an interface and cannot be constructed. Are you missing a type mapping?

Source Error: 

Line 30:             containe

Getting Started with Unity HoloLens

In this article we will discuss how we can the Unity HoloLens, development tool installation step by step guidelines and so on. As you all know the unity for developing 2D, 3D game application and its providing separate component as Unity HoloLens to support 2D, 3D, animation and so on. We will discuss step-by-step installation guidelines.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend