c# - How to write a wrapper for AreaRegistration -
i writing wrapper arearegistration constrain patterns different areas. code looks below:
public abstract class wrappedarearegistration : arearegistration { public abstract override string areaname { get; } public override void registerarea(arearegistrationcontext context) { var uri = string.format("wrapper/{0}/{{controller}}", areaname); context.maproute( string.format("{0}_default", areaname), uri, new { action = "index" }); } } in area a, there class called
public class : wrappedarearegistration { public override string areaname{ get{ return "a"; } } and have area b same code above.
public class b : wrappedarearegistration { public override string areaname{ get{ return "b"; } } the outcome of runtime is: area can routed area b hit 404 error. however, when traditional way, not using wrapper, direct using class , class b inherit arearegistration abstract class, don't have issue, , b can routed.
i installed tool called glimpse.mvc4 check route configuration @ run time, namespaces both area , area b "a" , "b".
Comments
Post a Comment