castle-dynamicproxy

Persisting a Castle DynamicProxy that's not associated with a NH Session

我的梦境 提交于 2019-12-13 04:48:21
问题 My session uses an NHInterceptor to add INotifyPropertyChanged support to models. // I use the session generated here to fetch Data public class SessionServiceImpl : ISessionService { [Inject] public ISessionFactory SessionFactory { get; set; } [Inject] public NhChangeNotificationInterceptorImpl ChangeNotificationInterceptor { get; set; } public ISession GetSession() // reduced code here { return SessionFactory.OpenSession(ChangeNotificationInterceptor); } } // This is the interceptor

Self-proxying constructor with Castle?

╄→гoц情女王★ 提交于 2019-12-12 05:13:12
问题 Is it possible for a class's constructor to wrap a proxy around itself? This code, unfortunately, causes a StackOverflowException. void Main() { var thing = new Thing(); } public static readonly ProxyGenerator generator = new ProxyGenerator(); public class Thing { public Thing() { generator.CreateClassProxyWithTarget(this); } } I want some way to guarantee that new instances of my class are wrapped in the proxy instead of having to create some kind of factory that creates proxied instance.

Castle Windsor proxies, implicit interfaces and WPF Binding

不羁的心 提交于 2019-12-10 20:11:49
问题 I am attempting to implement a WPF ViewModel using Castle Windsor Dynamic Proxies. The idea is that I want to supply an interface (IPerson below should suffice as an example), a concrete backing class, and an interceptor (for providing automatic implementation of INotifyPropertyChanged). The interceptor implementation is here: http://www.hightech.ir/SeeSharp/Best-Implementation-Of-INotifyPropertyChange-Ever The problem that I am seeing is that when I bind my models to WPF controls, the

help building castle dynamic proxy

走远了吗. 提交于 2019-12-08 17:46:30
So I pulled the source from https://svn.castleproject.org/svn/castle/DynamicProxy/trunk/ Open it up in vs.net 2008 problems: vs.net can't open the assembly.cs assembly signing failed What am I doing, rather NOT doing? Update So I downloaded nant, setup the .bat file in my PATH so it works in cmd prompt. I ran: nant default.build Getting this error: build failed, \buildscripts\common-project.xml (48,3) invalid element . Unknown task or datatype. How exactly do I build the dynamicProxy project now? update This is what I did, see screenshot: oh and my nant is: @echo off "E:\dev\tools\nant-bin

help building castle dynamic proxy

杀马特。学长 韩版系。学妹 提交于 2019-12-08 04:55:33
问题 So I pulled the source from https://svn.castleproject.org/svn/castle/DynamicProxy/trunk/ Open it up in vs.net 2008 problems: vs.net can't open the assembly.cs assembly signing failed What am I doing, rather NOT doing? Update So I downloaded nant, setup the .bat file in my PATH so it works in cmd prompt. I ran: nant default.build Getting this error: build failed, \buildscripts\common-project.xml (48,3) invalid element . Unknown task or datatype. How exactly do I build the dynamicProxy project

Dynamic cast to generic type

南笙酒味 提交于 2019-12-07 06:07:31
问题 Just a quickie before the weekend rolls in... I have a Method with the following signature, that I need to invoke: public interface IObjectProvider<T> { T Get(Predicate<T> condition); } This will provide me with a T from whatever kind of source, that meets the predicate criteria. Now, this has to be called from a context where all I have is the following: //the actual predicate that's going to be evaluated var predicate = predicateProperty.GetValue(invocation.InvocationTarget, null); //The

System.InvalidProgramException when executing unit tests in MSTest after Microsoft Security update MS13-004

跟風遠走 提交于 2019-12-07 03:04:11
问题 After applying the Microsoft Security update on the 8th of January 2013 http://technet.microsoft.com/en-us/security/bulletin/ms13-004 we have started to experience failures in our CI builds on our build servers and locally when running tests on our development boxes. We get a System.InvalidProgramException: Common Language Runtime detected an invalid program . This only happens when running tests using MSTest that make use of Castle Windsor DynamicProxy although I am not convinced

Castle Windsor InternalsVisibleTo Silverlight

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 02:27:07
问题 I'm using Castle Windsor for SL v2.5.1.0. I have it proxy internal classes (the interfaces are public of course, but the implementation is internal, so that the consumer is only aware of the interface). I'm using the following attributes in my assembly with the internal classes [assembly: InternalsVisibleTo("Castle.Core, PublicKey

Intercept only interface methods with DynamicProxy

眉间皱痕 提交于 2019-12-06 12:39:13
问题 I got an interface like this public interface IService { void InterceptedMethod(); } A class that implements that interface and also has another method public class Service : IService { public virtual void InterceptedMethod() { Console.WriteLine("InterceptedMethod"); } public virtual void SomeMethod() { Console.WriteLine("SomeMethod"); } } And an Interceptor public class MyInterceptor : IInterceptor { public void Intercept(IInvocation invocation) { Console.WriteLine("Intercepting");

Interception with Ninject. Fails to load IProxyRequestFactory

本小妞迷上赌 提交于 2019-12-06 04:38:56
问题 I'm learning to use Ninject and Interceptor pattern. I have the following interceptor. public class MyInterceptor:IInterceptor { public void Intercept(IInvocation invocation) { Console.WriteLine("Pre Execute: " + invocation.Request.Method.Name); foreach (var param in invocation.Request.Arguments) { Console.WriteLine("param : " + param); } invocation.Proceed(); Console.WriteLine("Post Execute: " + invocation.Request.Method.Name); Console.WriteLine("Returned: " + invocation.ReturnValue); } }