Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface IHttpHandlerBase : IHttpHandler
- {
- void RequestContext { get; set; }
- }
- public class GenericRouteHandler<T> : IRouteHandler
- where T : IHttpHandlerBase, new()
- {
- public IHttpHandler GetHttpHandler(RequestContext requestContext)
- {
- var retVal = new T();
- retVal.RequestContext = requestContext;
- return retVal;
- }
- }
- public class ImageHandler : IHttpHandlerBase
- {
- ...
- }
- // Это прописать в инициализации правил маршрутизации
- RouteTable.Routes.Add(new Route("Image/{ImageID}", new GenericRouteHandler<ImageHandler>()));
Advertisement
Add Comment
Please, Sign In to add comment