dependency-injection

Overhead from using Dependency Injection

Does dependency injection potentially cause large overhead? I would imagine so, especially if the resolver is called many times (which is quite likely looking at pattern examples)? Or am I thinking wrong? Unfortunately I can't test for myself as I have never used it but planned on using it. ...

Repository or dependency injection library for Azure

Can anyone point me at a decent repository or dependency injection library for any of the variations of Azure data services? I'm looking for quicker ways to bring applications to market and would like a library that allows (even more) minimal coding to persist and retrieve entities to the cloud. Preferably libraries that provide source...

Dependency Injection in PHP

I have been looking into Dependency Injection. Am I on to something or is it completely off? Is the code good or bad - Dependency Injection or not? The below code is the foundation for a CMS system Right now there is a table called "page_details" with all the web pages stored in it. Directory/file structure .htaccess index.php cla...

One DI Container for multiple ASP.Net applications

Hi All, I am trying to design a Infrastructure libraries for my company. Libraries will have typical components like logging, exception handling, email etc. These componants will be used by all the ASP.Net applications hosted on our environment (so hosting environment is my control). My first step in design is that I would not like the...

How to dynamically load modules in Prism / Composite Application Library?

I have a class in my Prism/CAL application which generates a form for users to fill in data. The form is defined by an XML file like this: <area idCode="general" title="General"> <column> <group title="Customer Data"> <field idCode="title" requiredStatus="true"> <label>title</label> ...

How do you make a Ninject Provider when the constructor of type is not known?

I decided to try to conjure up a container assembly to interact with FubuMVC. Well the cool part is that it pass all the test that the FubuMVC.Container.StructureMap assembly does. However, when I dropped it into the FubuSample. I received an activation error. The error is because in the provider for the behaviors I'm only calling a par...

Global variable vs DI Container.

Can someone describe pros and cons of both methods, and when you prefer one over another? interface IService { object GetSomething(); } class Service:IService{...} DI Container.Register<IService, Service>(); class A { public A(IService service) { _service = service; } } Global class Config { publi...

Spring - Ways to include a jar which itself is using Spring in a Spring project

I need to use some 3rd party jar in my project. The project is a Spring project and the jar is also using Spring. Is there a way by which I can include the 3rd party jar in my project? I am finding it difficult to find each and every dependency of the 3rd part jar and inject it. ...

Spring - When should I consider loading another context in same JVM?

I was just thinking that when should I actually consider loading more than one application contexts in Spring? All so far I have been merging the context files with <include> such that only one application context loads up. Do you have an idea about when to go for more than one application contexts in the same JVM? ...

Which of these tools/technologies should I start learning first?

I'm gearing up to jump ship at my current company in (hopefully) 9 months or so. I'm a c# developer but don't have experience past the 2.0 framework and VS2005 due to the OS limitations of our target environment. Last year we had a consultant come in for about 9 months or so and he opened my eyes to new technologies, etc.. I still kee...

Injecting business classes into businsess classes in a three layered architecture

I have a three layered Java application consisting of a presentation layer, a business layer, and a data access layer. In my application, the business layer contains what I am calling service classes and my data access layer contains what I'm calling data access classes. I am using Spring for dependency injection and to manage database t...

Spring.NET Creation of Object with Parameters

I have an object with two parameters that needs to be created via Spring.NET using the configuration file for decoupling. public Object(string param1, string param2) { ... } The two parameters are dynamically passed in based on user interaction where they pass in a username and password, so these values can't be hard coded to the conf...

Can I get a concrete type from an interface instance with Ninject?

I have contracts for functionality in my repository that are implemented with linq-to-sql. // IEvent was extracted from the generated linq-to-sql class public partial class Event : IEvent { } public class EventRepository : IEventRepository { public void Add(IEvent e) { db.Events.InsertOnSubmit(e); db.SubmitCha...

How to use dependency injection and the repository pattern with ASP.NET web services?

With regular ASP.NET MVC pages, the repository is passed in to the constructor of the control. Then the tests can instantiate the controller passing in a mock repository. How can I do this with web services? The problem I see is that we don't have the equivalent of ControllerBuilder.SetControllerFactory. What are the best practices t...

resolving circular dependencies with dependency injection

I've seen several articles on various websites that propose resolving circular dependencies between .NET assemblies by using dependency injection. This may resolve the build errors but it's not really resolving the circular dependency, is it? To me, there seems to still be a logical error in the architecture. Am I crazy or do others a...

Is there a good/proper way of solving the dependency injection loop problem in the ASP.NET MVC ContactsManager tutorial?

If you don't know what I'm talking about either go through the tutorial and try to add dependency Injection yourself or try your luck with my explanation of the problem. Note: This problem isn't within the scope of the original tutorial on ASP.NET. The tutorial only suggests that the patterns used are dependency injection friendly. The...

Data access, unit testing, dependency injection

Hello all, I've recently got a task to create a simple utility that allows to import data from a file with special format to the database. I've implemented console application with few classes(Program class operates with business logic class, business logic class in turn operates with data access class). Everything works ok, but now I'm...

File access, unit testing, dependency injection

Hello, I've recently asked a question regarding best ways of separating business logic from data access to make application testable (here). Thanks to Jeff Sternal, I've created interface for the data access and passing its concrete implementation from the application top level to BL. But now I'm trying to figure out how can I separate ...

Spring - How to load a new hierarchical context?

Hello, Has anyone tried loading multiple hierarchical contexts (parent/child) using Spring? Could you explain how to do that as I could not locate enough documentation on this? Thanks in advance. ...

Spring - Weird Error in Bean Creation

Any idea why I am getting this exception? Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myService' defined in class path resource [context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type...