spring.net

NHibernate 2.1.1 references an older version of Spring

NHibernate 2.1.0 references Spring 1.3.0. NHibernate 2.1.1 references Spring 0.0.0.2. Is there any special reason for that? I upgraded to NHibernate 2.1.1 and now I'm getting Assembly loading errors. ...

Using Spring.Net to inject dependencies into ASP.NET MVC ActionFilters

I'm using MvcContrib to do my Spring.Net ASP.Net MVC controller dependency injection. My dependencies are not being injected into my CustomAttribute action filter. How to I get my dependencies into it? Say you have an ActionFilter that looks like so: public class CustomAttribute : ActionFilterAttribute, ICustomAttribute { private IA...

How should I be configuring spring and hibernate so that my Integration Tests replicate properly the behaviour of the Web application ?

We have a web application based on NSpring 1.2 and NHibernate 2 and use HibernateTemplate. The web application is configured to use OpenSessionInViewModule. In our integration tests however the hibernate session is marked as InitDeferredClose and for the most part this works fine for our tests. There are some service functions that w...

spring.net validation

Hi, I'm trying to use the Spring.net framework for the first time. I would like to use its validation capabilities. I'm currently trying to validate business objects, so I have defined several validators (in the App config file). I retrieve these validators through the IOC (ContextRegistry.GetContext().GetObject(validator name)). I woul...

Configuring a tabulator set to a string via Spring.NET

I'm trying to get Spring.Net to set a tab to a property (Separators) on my service class, however whatever I try to use e.g. "\u0009" or a real tabulator spring refuses to use a tab. The real tab is set as a space, the unicode is escaped, "\t" is escaped as well. <object name="s:SomeKindOfService" type="Services.SomeKindOfService, Assem...

Dettaching Nunit from VS debug mode takes too long

I am using VS2008 and Nunit. My application uses Spring.NET Framework for dependency injection. I attached Nunit to VS to debug. Loading Nunit takes time and even worse after the test fails/success, I stop it. deattaching duration is more than 2 minutes. I tried to restart everything, clear the cache on "\WINDOWS\Microsoft.NET\Framework...

Unit testing a WCF service with multiple dependencies

I certainly hope someone can help ease my frustration. I am trying to find a good way to unit test my WCF service implementation classes but every resource that I've found providing a solution is limited to services with only a single method/operation. In my case, I have a service class which contains several service methods/operations...

Spring.NET Configuration Question

I'm a Java developer being forced to learn C#. Since I couldn't stand NOT using a Dependency Injection container, I'm trying to configure Spring.NET in my project. My project is divided into two solutions in Visual Studio: a ClassLibrary solution for all my business logic, services, DAOs, etc, and a Webapp section (ASP.NET pages, etc). ...

Rhino Mocks - using AssertWasCalled on Common.Logging ILog.Debug

I'm having trouble using Rhino Mocks to assert that a method was called (and ideally with a particular parameter). The Method is ILog.Debug(FormatMessageHandler) in Common.Logging 2.0 using the new lamba syntax. It works fine using the old way plain ILog.Debug(string). // Sample Code to Test public int TestFuncLambda(ILog log,...

caching per request in ASP.NET?

I'm using both IBatis.NET and Spring.NET on a project at work and I'd like to figure out if I can leverage both/either frameworks to achieve "per-request caching" on all calls into my DAL layer. In other words, every time an HTTP request is served by ASP.NET, I would like first call into a DAL method to hit the remote DB, but all calls ...

How to change configs in Spring.Net

An advantage of an IoC container is that you can swap in a mock service at the bottom of your object graph. However this seems much harder to do in Spring.Net than in other IoC Containers. Here's some code that does it in Unity and has Spring.Net code; namespace IocSpringDemo { using Microsoft.Practices.Unity; using NUnit.Framew...

Security exception on IIS 7.5 with no shared folder

I get an exception after upgrading Spring.NET 1.2 to 1.3 in my web application. Here's the setup on my web app: I created an application pool with its identity set to ApplicationPoolIdentity. I use NHibernate 2.1, my SQL Server 2008 is local and I'm using SQL server authentication. There's no network or shared folder. Everything is loca...

Spring.NET & Immediacy CMS (or how to inject to server side controls without using PageHandlerFactory for pages)

Is there any way to inject dependencies into an Immediacy CMS control using Spring.NET, ideally without having to use to ContextRegistry when initialising the control? Update, with my own answer The issue here is that Immediacy already has a handler defined in web.config that deals with all aspx pages, & so it's not possible add an ent...

Castle Windsor or Spring.NET - advantages and disadvantages

Yesterday I was reading some articles in this site while I stumbled on an article about this two new IoC tools. Which one should I learn first? Is there some specification about which one should be used when? ...

Configure static properties with spring.NET

What are best practices to configure following class with spring.NET? using System.Collections.Generic; using Edu3.DTOModel; namespace Edu3.Data.SubsonicProvider.RepositoryFramework { public static class RepositoryFactory { private static readonly Dictionary<string, object> Repositories = new Dictionary<str...

Get typeof(...).Name using Spring.NET

Is there a way to get the string representation of an interface using Spring.NET? In code: typeof(ISsoUrlTemplateRepository).Name I would need this name in Spring.NET configuration... I could just take the string itself but if I would ever refactor and change the names of some interfaces, the Spring configuration wouldn't work anymor...

Replace Spring.Net IoC with another Container (e.g. Ninject)

Hey all, I'm curious to know if it's possible to replace Spring.Net's built-in IoC container with Ninject. We use Ninject on my team for IoC in our other projects so I would like to continue using that container if possible. Is this possible? Has anyone written a Ninject-Spring.Net Adapter?? Edit I like many parts of the Spring.Net...

Pass type of a class as value in Spring.NET

Is there a way to pass a type of a class as the value in Spring.NET? My Dictionary looks like this: private Dictionary<int, Type> ContentItemTypes { get; set; } In code I would initialize as: registry.addContentItemType(0, typeof(ContentItem)); How do you do this in Spring.NET. So far I have this: <object id="ContentItemTypeRegis...

Use Property as factory-method in Spring.Net

Is there a way to use a static property of a class as the factory-method for a object definition? <object id="MyObject" type="MyNamespace.Factory, MyAssembly" factory-method="FactoryObject" /> <!-- "FactoryObject" is a Property (with getter) of the class "Factory" --> Using this config a exception is thrown: Error creating cont...

Spring.NET Dependencies Not Injecting

I am trying to create an ASP.NET MVC application, using Spring.NET to inject dependencies. The application has three tiers: Controller, Service, and Data. I have defined the objects in the file "~\Resources\objects.xml". My first object, UserAccountController, requires the injecion of two Service-tier classes: UserAccountService and ...