I have a class UserModel
I want to proxy it for caching. So i've set up public class UserModelCached:DynamicProxy<UserModel>
via http://greenicicleblog.com/2010/02/21/piece-of-proxy-cake/
Now I want Ninject to still be able to create a UserModel
but when a UserModel
is asked for it returns the proxy instead.
Everything I can think of seems it would result in a stack overflow because ninject would ask how to create a UserModel to create the proxy; the internal dictionary for where to get one would point to the same method that gets the dynamic proxy instead. I don't want to hardcode the parameters of the actual UserModel
class.
Is this possible without creating an interface and adding it to both classes?