The Hurdles Of Playing With ASP.Net
A couple
of days ago I posted an idea about how simple it is to create an MVC framework
on top of ASP.Net without affecting much of the development model. Since then,
I got a chance to play with it a bit, and I'm surprised at what I found.
First,
the tests were done using Web Application Projects, since there isn't even a
point to start doing this in Web Site Project (although the implementation that
I have right now will work there as well).
Ideally,
what I would have wanted to do is to reflect over all the pages that implements
a certain interface, IView (to be original) and add them to the IoC container,
then when a request come in, I resolve it to the proper controller based on the
URL, and the controller gets is view (the page) from the container.
The
problem is this, there is not easy way to get the type of the page object from
ASP.Net. The pages themselves are compiled the first time that they are request
(simplified), so there isn't a good way to handle it except use
GetCompiledPageInstance(), and this ties me back to the paths on the HD.
I
suppose that I can write some component that will find all the .aspx files in
the directory, and register them, but this looks really clunky to me.
Right
now I'm using strings based approach, somewhat similar to the way MonoRail is
working, and I inject Hashtables to the view. The problem with this approach is
that I lose all the strong typing that I could get if I could get the
interfaces to work.
Comments?
Comments
Comment preview