Note that there are some explanatory texts on larger screens.

plurals
  1. POCan I define custom attributes for proxy type in Castle Windsor
    primarykey
    data
    text
    <p>I have a class that I proxy it with Castle Dynamic Proxy. I want to add some custom Attributes to proxy methods (which is not defined in proxied class). Is this possible.</p> <p>I want this because I want to generate ASP.NET Web API layer for my application's Service Layer. I proxied services (with inheriting from ApiController and additional IMyService interfaces), it works great but I want to add WebAPI specific attributes to this newly created Dynamic class, thus Web API framework can read them.</p> <p><strong>EDIT</strong>:</p> <p>I want to explain detailed if someone want to know what I want actually.</p> <pre><code>public interface IMyService { IEnumerable&lt;MyEntity&gt; GetAll(); } public class MyServiceImpl : IMyService { public IEnumerable&lt;MyEntity&gt; GetAll() { return new List&lt;MyEntity&gt;(); //TODO: Get from database! } } public class MyServiceApiController : ApiController,IMyService { private readonly IMyService _myService; public MyServiceApiController(IMyService myService) { _myService = myService; } public IEnumerable&lt;MyEntity&gt; GetAll() { return _myService.GetAll(); } } </code></pre> <p>Think that I have a IMyService which is implemented by MyServiceImpl. And I want to make a Api controller to be able to use this service from web. But as you see, api controller is just a proxy for real service. So, why I should write it? I can dynamically create it using castle windsor.</p> <p>This is my idea and almost done it in my new project (<a href="https://github.com/hikalkan/aspnetboilerplate" rel="noreferrer">https://github.com/hikalkan/aspnetboilerplate</a>). But what if I need to add some attribute (such as Authorize) to GetAll method of the api controller. I cant directly add since there is no such a class, it's castle dynamic proxy.</p> <p>So, beside this problem. I want to know if it's possible to add a attribute to a method of a synamic proxy class.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload