iinterceptor

NHibernate IInterceptor implementation(without extending domain classes with special properties)

How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties? for example: in my case i would like to get object and just moment before update/insert db add to that object some additional information (like user id or computer name) by using IInterc...

NHibernate IInterceptor implementation(add properties to DB table that original domain class doesn't have)

How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties? for example: in my case i would like to get object and just moment before update/insert db add to that object some additional information (like user id or computer name) by using IInterce...

How to use Unity's InterfaceInterceptor with Generic Interface Chain

Hi There! Right now I'm having a problem with Unity InterfaceInterceptor because it will fail when constructing the dynamic type. My classes and interfaces are something like this: public interface IService<T> { void Save(T entity); } public interface IOrderService : IService<Order> { void GetCustomerOrders(Customer custome...

Castle.Windsor Register AllTypes With An Interceptor

Why does the following not intercept calls to IBusinessService with the LogAspect? container.Register(AllTypes.Of<IBusinessService>() .FromAssembly(Assembly.GetExecutingAssembly()) .ConfigureFor<BusinessService>( c => c.Named(typeof(BusinessService).Name) .Interceptors(InterceptorReference.ForType<LogAspect>(...

NHibernate add unmapped column in interceptor

I'm trying to save a mapped entity using NHibernate but my insert to the database fails because the underlying table has a column that does not allow nulls and IS NOT mapped in my domain object. The reason it isn't mapped is because the column in question supports a legacy application and has no relevance to my application - so I'd like ...

Castle DynamicProxy2: Get the Target inside an Interceptor?

I'm using Castle DynamicProxy2 to "tack on" interfaces to retrieve fields from a dictionary. For example, given the following class: public class DataContainer : IDataContainer { private Dictionary<string, object> _Fields = null; public Dictionary<string, object> Data { get { return _Fields ?? (_Fields = new Dictio...

Filtering objects OnLoad NHibernate IInterceptor

Hello, I am having a problem loading objects using NHibernate. These entities have reference to files which no longer exist. When NHibernate assigns the 'Path' property of these entities these entities try to load the file which results in a an exception. The exception causes the loading transaction to roll-back completely. I would lik...

Castle Interceptors With Fluent Interface

I'm trying to get an interceptor I've written to work, but for some reason it doesn't seem to be instantiating the interceptor when I request my components. I'm doing something like this (forgive me if this doesn't quite compile, but you should get the idea): container.Register( Component.For<MyInterceptor>().LifeStyle.Transient, ...

Problem with Windsor Calls to "Genericized" Methods After Adding an Interceptor

I have an application that was working fine that uses Windsor for IoC. I want to log the method calls, parameters, and execution time of all calls made to components instantiated by Windsor, so I implemented a LoggingInterceptor that implements IInterceptor, that contains: Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); ...

Register custom NHibernate Interceptor via Windsor

I created a simple AuditInterceptor: EmptyInterceptor now I wonder how can I register this new interceptor with my application using Windsor? ...

saving objects in NHibernate IInterceptor

Hello, I set up an IInterceptor for ILoggable objects in my domain model. And on OnFlushDirty event, i am trying to save a log (audit). But while doing this, my code goes into an infinite loop. _logrepository.Save(log) calls OnFlushDirty even if log is not an ILoggable object (it is because entity is still the previous object) Is the...

Lazy load a collection of data from a service, not the database

My domain objects support custom fields that are stored in such a way that requires metadata and logic to be applied before their values can be stored and retrieved. I already have a Custom Field Repository that handles the persistence of custom fields, and I don't want to try to recreate that logic in NHibernate mappings. I would ho...

Register an Interceptor with Castle Fluent Interface

I am trying to implement nhibernate transaction handling through Interceptors and couldn’t figure out how to register the interface through fluent mechanism. I see a Component.For<ServicesInterceptor>().Interceptors but not sure how to use it. Can someone help me out? This example seemed a little complex. ...

Proxy is created, and interceptor is in the __interceptors array, but the interceptor is never called

This is the first time I've used interceptors with the fluent registration and I'm missing something. With the following registration, I can resolve an IProcessingStep, and it's a proxy class and the interceptor is in the __interceptors array, but for some reason, the interceptor is not called. Any ideas what I'm missing? Thanks, Drew...

Intercept Properties With Castle Windsor IInterceptor

Does anyone have a suggestion on a better way to intercept a properties with Castle DynamicProxy? Specifcally, I need the PropertyInfo that I'm intercepting, but it's not directly on the IInvocation, so what I do is: public static PropertyInfo GetProperty(this MethodInfo method) { bool takesArg = method.GetParameters...

NHibernate inteceptor not called for changes in many-to-many set/list

I have an application that uses NHibrenate and I'm using an interceptor based solution for logging/auditing. Basically I have a class inheriting from EmptyInterceptor and overriding OnFlushDirty, OnSave and OnDelete. Everything works perfectly - except - when I add or remove from a set or list that is mapped using many-to-many without ...

How to do URL authentication in struts2

Hi, I am using struts2.1.6 + Spring 2.5 I have four modules in my application. Registration Module Admin Module Quote Module Location Module. In registration module the customer can register himself and only after registering he is supposed to have access of the remaining three modules. I want to implement something like if the acti...

Is it better to create proxies for table with multi-faceted domains or use inheritance?

I'm using NHibernate and Dynamic Proxy. I have one table (Customer) with generic fields: charField1, charField2, etc. One record in this table may represent company A while another record may represent company B. However, a different domain model will exist for company A's data than company B's data because they require different informa...

Castle.Core.InterceptorAttribute not injecting interceptor.

Based on the documentation for Castle.Core.InterceptorAttribute, I am trying to make this simple test pass, and am having no luck: using NUnit.Framework; using Castle.DynamicProxy; using Castle.Core; using Castle.MicroKernel; using Castle.MicroKernel.Registration; public interface IIntercepted { string get(); } [Interceptor(typeof(Te...