Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>sorry I have only limited time atm, plz ping me if the description below should be too short/abstract</p> <p>First, there is no such functionality yet available. But with a few lines of code you can do this on your own. </p> <p>In general below I will be pursuing the idea of mapping a particular class onto an object-definition to be used for configuring the instance. Something along the lines of</p> <pre><code>if (object is MyBaseClass) applicationContext.Configure(object, "myObjectDefinitionName"); </code></pre> <p>Here's the outline of a solution: Since your problem is ASP.NET WebForms-related, an HttpModule is a good starting point to hook into creating and configuring .aspx pages. The idea is to write your own IHttpModule that performs the page configuration right before it gets executed. Basically all you need is</p> <pre><code>public class MyBaseClassConfigurationModule : IHttpModule { private System.Collections.Generic.Dictionary&lt;Type, String&gt; typeObjectDefinitionMap; public void Dispose() {} public void Init(HttpApplication context) { context.PreRequestHandlerExecute += context_PreRequestHandlerExecute; } void context_PreRequestHandlerExecute(object sender, EventArgs e) { IHttpHandler handler = ((HttpApplication )sender).Context.Handler; foreach(Type t in typeObjectDefinitionMap.Keys) { if (t.IsAssignableFrom(app.Context.Handler.GetType)) { Spring.Context.Support.WebApplicationContext.Current .ConfigureObject(handler, typeObjectDefinitionMap[t]); } } } } </code></pre> <p>and configure your module according to <a href="http://www.springframework.net/doc-latest/reference/html/web.html#web-di-modules" rel="nofollow noreferrer">22.4.2. Injecting dependencies into custom HTTP modules</a>.</p> <p>hth, Erich</p>
 

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