Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
0 answers
80 views

ParameterOverride in Unity for parameterized constructor c#

I am using version 1.2.0.0 of Microsoft.Practices.Unity and i want to resolve dependency for a parameterized constructor which takes two arguments. I am not able to use ParameterOverride, error says ...
Shilpa's user avatar
  • 422
0 votes
1 answer
733 views

WCF, Unity Container Microsoft.Practices.Unity.Configuration.dll but was not handled in user code

I am working on WCF with Unity Dependency injection. Everything was working fine in VS2012 Service is in 32 bit version. Now We are upgrading service to x64 bit version, Service getting update success....
user1255105's user avatar
0 votes
2 answers
289 views

AOP Unity and EF POCO best workflow

I want to “inject” AOP aspects on a domain POCO class using a Unity container at the moment when the POCO object is being constructed from the database by Entity Framework ORM Unity can easily “...
alhpe's user avatar
  • 1,504
0 votes
1 answer
79 views

TypeMatchingRule XML configuration resolves the class type instead of implemented interface

I am adapting the code found http://www.christophdebaene.com/blog/2008/11/02/aop-in-action-part-1-dirty-tracking-using-unity-interception/ to my own needs I would do like to translate my working ...
alhpe's user avatar
  • 1,504
1 vote
1 answer
506 views

ICallHandler, is an interface and cannot be constructed

At code below I got the error: ICallHandler, is an interface and cannot be constructed when resolving the object var attributePolicy = new AttributeDrivenPolicy(); var ...
alhpe's user avatar
  • 1,504
1 vote
1 answer
430 views

Unity logging static methods AOP style or without interface

Using PostSharp I can log in AOP-style(by using attributes) static methods or methods of classes than not implements interfacese. Can I do this with Unity - logging in AOP style without interfaces?
IComparable's user avatar
1 vote
1 answer
1k views

Policy Injection Intercept not working for WebAPI Controllers

I'm implementing Policy injection with web api and for DI we are using custom DependancyResolver. I have used InterfaceIntercept approach to implement policy injection. It is working fine in case of ...
ggtffg's user avatar
  • 323
0 votes
1 answer
382 views

(Microsoft.Practices.EnterpriseLibrary.SemanticLogging) Injection EventSource in SqlDatabaseLog.EnableEvents

I have just recently added Microsoft.Practices.EnterpriseLibrary.SemanticLogging (v6) with SqlServer silk in my MVC 4 application. var sqlListener = SqlDatabaseLog.CreateListener("SampleEventLogger",...
MetalMad's user avatar
  • 446
0 votes
1 answer
322 views

how to combine PolicyInjection.Create and UnityContainer.RegisterType?

My web application uses UnityContainer. I want to add Policy injection. How can I use both of them side by side? meaning who should be responsible of the types registration? policy injsection: ...
Elad Benda's user avatar
  • 36.6k
0 votes
3 answers
2k views

Abstract Factory and Unity Dependency Injection

Im very unsure how i should approach this as im new to the Unity Container. Heres a factory i have: class DataCopierFactory : IDataCopierFactory { private readonly IUnityContainer _container; ...
niallNoigeallach's user avatar
3 votes
1 answer
3k views

Where should I register-resolve my types in a Console Application with Unity Container?

I am a beginner to Unity DI Container. I want to use it with a simple Console app. I will use 'Code as Configuration' Where should I call my method that Registers and Resolves my abstracts? From ...
pencilCake's user avatar
  • 53.1k
1 vote
1 answer
232 views

How to inject constructor parameter deep in the dependcies at runtime while resolving through unity

In the below if I am trying to inject a constructor parameter in one of the dependencies of the model at runtime, it doesn't take with Parameter Override option. Is there any thing else that we need ...
sqlnewbie's user avatar
  • 867
0 votes
2 answers
2k views

Unable to step into interface implementation configured by unity application block

I have configured a set of interface implementations with EntLib. unity block. The constructor of implementation classes work fine as soon as I run the application: 1. The interface to implement when ...
Rahul's user avatar
  • 410
1 vote
1 answer
4k views

Unity DI for static member (for example in static class program) / when do members get populated

I'm trying to get started with unity and I'm looking for help with this particular problem: I already understand what dependency injection / unity is and how to do this programatically but I do not ...
user1430306's user avatar
5 votes
3 answers
2k views

Testing Code that is dependency on Enterprise Library even though it doesn't provide interfaces?

Maybe I'm showing my lack of understanding of dependency injection and testing, but I don't understand how using dependency injection with classes that don't implement interfaces helps me at all with ...
Bob Wintemberg's user avatar
15 votes
5 answers
3k views

How to Decouple IoC Framework Implementation

I've been learning IoC, Dependency Injection etc. and enjoying the process. The benefits of decoupling and programming to interfaces are, to me, a no-brainer. However, I really don't like binding ...
Richard's user avatar
  • 5,998
2 votes
1 answer
1k views

References to Separate Projects When Configuring Unity?

I read a really cool blog about using Autofac to completely decouple an application. But try as I might (and being horribly new to all this), I just couldn't get Autofac to gel. I turned to Unity ...
Richard's user avatar
  • 5,998
1 vote
0 answers
271 views

Logging Strategies with mvc 3

good day, I am writting something that will be extended in multiple upcoming releases. The only reason now I'm mentioning this is because new functionality included in the controllers will have to be ...
dexter's user avatar
  • 7,193
3 votes
1 answer
3k views

entlib Invalid TraceListenerData type

I've created a custom listener for Enterprise Library 5 Logging Block, which is recognized by the Configuration Editor, but throws a run-time configuration exception: Attempt to Use the Custom Logger ...
Cel's user avatar
  • 6,629
1 vote
1 answer
2k views

entlib CustomTraceListener unresolved

im new to Enterprise Library (5, with the optional update), and am trying to use my own CustomTraceListener with the Logging Block. Logging works with a supplied flat file listener, but i dont seem ...
Cel's user avatar
  • 6,629
0 votes
1 answer
691 views

Using Unity.BuildUp in one class breaks injection in other class

I've got a membership provider that creates a problem with dependency injection. I would like to understand why it happens. This is some parts of a base controller. (It works like it should.) ...
Carl R's user avatar
  • 8,204
1 vote
2 answers
389 views

Programatically update a configuration within a container

In my app I ask the user which database they want to connect to and I was writing it back into EL5.0 like this: var builder = new ConfigurationSourceBuilder(); builder.ConfigureData() ...
Stephen Turner's user avatar
0 votes
2 answers
296 views

Enterprise Library - Get value from ParameterValue Expression

I am trying to convert Enterprise Library TypeRegistration ConstructorParameters to a collection of key/value pair (a HashTable or an IDictionary in general). The ConstructorParameters property is an ...
Nikos Baxevanis's user avatar
5 votes
1 answer
3k views

Using abstract factory as injectionfactory in Unity?

I have an abstract factory registered for injection in some controller instances. Can I register that abstract factory and use it as an injection factory? This is what I have: public interface ...
Carl R's user avatar
  • 8,204
0 votes
1 answer
279 views

Inject values into custom VAB validator

I'm building a mvc webapp that shares model objects with an existing winforms app. I'm introducing VAB validation into it. One of the items I need to validate is an int that can be one of x levels. I'...
Carl R's user avatar
  • 8,204
1 vote
1 answer
952 views

Unity Injection question passing information to multiple layers

I'm trying to used Unity to do some dependency injection with some cross-cutting classes. Right now I have some caching infrastructure that I've wrapped around the MS enterprise library. I'm ...
Chris Cap's user avatar
  • 1,068
2 votes
1 answer
4k views

When does EnterpriseLibraryContainer instance get created?

I am trying out Enterprise Library 5.0. My plan is to use it for coming project with ASP.Net MVC. I saw a few examples and was trying out the logging. In of the example, I see the developer get an ...
Abdel Raoof Olakara's user avatar
2 votes
3 answers
2k views

How to perform duplicate key validation using entlib (or DataAnnotations), MVC, and Repository pattern

I have a set of ASP.NET 4 projects that culminate in an MVC (3 RC2) app. The solution uses Unity and EntLib Validation for cross-cutting dependency injection and validation. Both are working great for ...
danludwig's user avatar
  • 47.3k
0 votes
3 answers
2k views

.Net Unity Object instance issues

I really stuck trying to get unity to work for a c# project I'm working on. Its throwing an "Object reference not set to an instance of an object" error in my unity controller factory class. ...
Thomas Buckley's user avatar
1 vote
1 answer
906 views

How to do IServiceLocator constructor injection via config file?

How to inject IServiceLocator to my class constructor? When I tried to do this via my config, described above I got an Exception that it could not to create a RequestHandlersFactory class because ...
Brian J. Hakim's user avatar
1 vote
2 answers
2k views

Microsoft Unity- Issue With Resolve

I am looking to do this: container.Resolve(); When it does this, its going to inject a IDependency into the underlying entity object. However, the dependency stored within the container requires an ...
Brian Mains's user avatar
  • 50.7k
0 votes
1 answer
332 views

How to instantiate unitofwork

I am using Dependency Injection pattern to resolve correct instance of mine UnitOfWork. When I am using only one type mapping, all is ok unityContainer.RegisterType<IUnitOfWork, UnitOfWork>();...
Brian J. Hakim's user avatar