Re: Could not find a parameterless constructor.

221 views
Skip to first unread message

Patrick Steele

unread,
Aug 24, 2012, 10:48:45 AM8/24/12
to castle-pro...@googlegroups.com
It looks like the non-generic version of CreateClassProxyWithTarget
includes an overload where you can supply ctor arguments.

---
Patrick Steele
http://weblogs.asp.net/psteele


On Fri, Aug 24, 2012 at 1:14 AM, Rumba1982 <rman...@gmail.com> wrote:
> This is just an example, I have some classes that don't have constructor no
> parameters, but overloaded constructors. How can I create proxy for
> something like this below.
>
> HelloWorld target = new HelloWorld("SomeValue");
> target.Name = "Hello";
>
> target = proxy.CreateClassProxyWithTarget<HelloWorld>(target, new
> HelloInterceptor());
>
> Can not instantiate proxy of class: ConsoleApplication1.HelloWorld.
> Could not find a parameterless constructor.
>
> Thanks
> Rusty
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/castle-project-users/-/VYoI0ICWaE4J.
> To post to this group, send email to castle-pro...@googlegroups.com.
> To unsubscribe from this group, send email to
> castle-project-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.

Rumba1982

unread,
Aug 25, 2012, 12:55:17 AM8/25/12
to castle-pro...@googlegroups.com
Thanks Patrick, How can I extract constructor arguments. I want to target class gets supplied to StructureMap Type interceptor and some how there I would have to extract the constructor args to non generic method you mentioned below. Is that achievable?

Rusty

Patrick Steele

unread,
Aug 28, 2012, 9:32:30 PM8/28/12
to castle-pro...@googlegroups.com
Extract them from where?

As for your StructureMap reference, I've never used it so I'm not
familiar with how it works.

---
Patrick Steele
http://weblogs.asp.net/psteele


>> > castle-project-u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/castle-project-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/castle-project-users/-/YKw95DFcDGEJ.
> To post to this group, send email to castle-pro...@googlegroups.com.
> To unsubscribe from this group, send email to
> castle-project-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages