All Questions
Tagged with enterprise-library dependency-injection
32 questions
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 ...
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....
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 “...
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 ...
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 ...
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?
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 ...
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",...
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:
...
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;
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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 ...
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.)
...
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()
...
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 ...
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 ...
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'...
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 ...
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 ...
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 ...
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.
...
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 ...
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 ...
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>();...