<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET MVC</title><link>http://forums.asp.net/1146.aspx</link><description>Discussions regarding Model-View-Controller (MVC) support in ASP.NET.  &lt;a href="http://forums.asp.net/1215.aspx"&gt;T4MVC subforum&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Thoughts inspired by ASP.NET MVC Programming model</title><link>http://forums.asp.net/thread/2248048.aspx</link><pubDate>Sat, 22 Mar 2008 00:06:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2248048</guid><dc:creator>DanFinch</dc:creator><author>DanFinch</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2248048.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2248048</wfw:commentRss><description>&lt;p&gt;I think ASP.NET MVC strengthens AJAX development. ASP.NET MVC facilitates a RESTful (or at least RESTish) approach to writing your application, great for integration of all clients, including browsers. Typically your site will be a collection of pages and the interactive AJAX applications will reside on specific pages, so I don&amp;#39;t see that as being an obstacle. An entire site in one primary request &lt;i&gt;typically&lt;/i&gt; is not what most sites will look like (and there are good &lt;strike&gt;buzzwords&lt;/strike&gt; reasons for this - semantic web, search engine optimization), but MVC affects that approach little. Good components will take advantage of the intuitive nature of MVC to provide strong AJAX support. I suspect the developers have this in mind, and I wouldn&amp;#39;t be surprised to see something analogous to the ScriptManager to embed proxies to WCF services. The solution that immediately comes to mind is simply requesting views from client script, which is the subject of other topics and a number of blog posts.&lt;/p&gt;
&lt;p&gt;A hack, maybe, but this is an example, assuming your ViewData is consumable by WCF:&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&amp;nbsp;
&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;public abstract class&lt;/span&gt; SerializedViewPage&amp;lt;T&amp;gt; : ViewPage&amp;lt;T&amp;gt;&lt;br /&gt;{&lt;br /&gt;	&lt;span class="kwd"&gt;public override void&lt;/span&gt; RenderView(ViewContext viewContext)&lt;br /&gt;	{&lt;br /&gt;		&lt;span class="kwd"&gt;if&lt;/span&gt; (viewContext.HttpContext.Request.QueryString[&lt;span class="st"&gt;&amp;quot;format&amp;quot;&lt;/span&gt;] == &lt;span class="st"&gt;&amp;quot;json&amp;quot;&lt;/span&gt;)&lt;br /&gt;		{&lt;br /&gt;			viewContext.HttpContext.Response.ContentType = &lt;span class="st"&gt;&amp;quot;application/json&amp;quot;&lt;/span&gt;;&lt;br /&gt;			var serializer = &lt;span class="kwd"&gt;new&lt;/span&gt; DataContractJsonSerializer(&lt;span class="kwd"&gt;typeof&lt;/span&gt;(T));&lt;br /&gt;			serializer.WriteObject(HttpContext.Current.Response.OutputStream, ViewData);&lt;br /&gt;		}&lt;br /&gt;		&lt;span class="kwd"&gt;else if&lt;/span&gt; (viewContext.HttpContext.Request.QueryString[&lt;span class="st"&gt;&amp;quot;format&amp;quot;&lt;/span&gt;] == &lt;span class="st"&gt;&amp;quot;xml&amp;quot;&lt;/span&gt;)&lt;br /&gt;		{&lt;br /&gt;			viewContext.HttpContext.Response.ContentType = &lt;span class="st"&gt;&amp;quot;application/xml&amp;quot;&lt;/span&gt;;&lt;br /&gt;			var serializer = &lt;span class="kwd"&gt;new&lt;/span&gt; DataContractSerializer(&lt;span class="kwd"&gt;typeof&lt;/span&gt;(T));&lt;br /&gt;			serializer.WriteObject(HttpContext.Current.Response.OutputStream, ViewData);&lt;br /&gt;		}&lt;br /&gt;		&lt;span class="kwd"&gt;else&lt;/span&gt;&lt;br /&gt;		{&lt;br /&gt;			&lt;span class="kwd"&gt;base&lt;/span&gt;.RenderView(viewContext);&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;}&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: Thoughts inspired by ASP.NET MVC Programming model</title><link>http://forums.asp.net/thread/2236993.aspx</link><pubDate>Mon, 17 Mar 2008 10:16:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2236993</guid><dc:creator>SteveSanderson</dc:creator><author>SteveSanderson</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2236993.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2236993</wfw:commentRss><description>&lt;p&gt;Hey Adar, those are some good thoughts.&lt;/p&gt;&lt;p&gt;1. You&amp;#39;re right: ASP.NET MVC is focused on generating complete HTML pages so the web browser can navigate through them in a traditional way. As you predict, this model will likely fade away eventually (see Google Web Toolkit or &lt;a href="http://blog.codeville.net/2007/12/22/client-side-mvc-with-jmvc-and-aspnet-mvc/"&gt;client-side MVC approaches&lt;/a&gt;) but for the next few years at least, for interoperability and meeting-the-public&amp;#39;s-expectations reasons, we still need to support the traditional web page model.&lt;/p&gt;&lt;p&gt;2. Naming isn&amp;#39;t clear yet. Who knows what ASP.NET MVC will be called when it gets to a final release? Also, it is built on ASP.NET, and shares a lot of common infrastructure, including the WebForms engine, so you can&amp;#39;t say it&amp;#39;s &amp;quot;not&amp;quot; ASP.NET.&amp;nbsp;&lt;/p&gt;&lt;p&gt;3.&amp;nbsp; You can definitely share the &amp;quot;model&amp;quot; portion of your MVC triad across web and desktop apps without any code changes. Almost all your business rules should be in the model. You could conceivably try to share controller code, but there shouldn&amp;#39;t be much business logic there, and it&amp;#39;s probably too hard to be worth it. You definitely can&amp;#39;t share the Views portion - WebForms views are all about the web.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Thoughts inspired by ASP.NET MVC Programming model</title><link>http://forums.asp.net/thread/2236880.aspx</link><pubDate>Mon, 17 Mar 2008 08:56:36 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2236880</guid><dc:creator>AdarWesley</dc:creator><author>AdarWesley</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2236880.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2236880</wfw:commentRss><description>&lt;p&gt;I have been reading Scott Guthrie&amp;#39;s and Scott Hanselman&amp;#39;s posts on ASP.NET MVC and it got me thinking.&amp;nbsp; Here are a few points that I think would be interesting to discuss further:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;Quite soon after I started developing &lt;strong&gt;Business Web Applications&lt;/strong&gt;, circa 2001, I came to the conclusion that the programming model offered at the time did not suite a &lt;strong&gt;Business Application&lt;/strong&gt; so well.&amp;nbsp; HTML, then ASP, and finally ASP.NET, had serious shortcomings as far as developing &lt;strong&gt;Business Applications&lt;/strong&gt;.&amp;nbsp; This is not to say that it was not possible to develop them.&lt;br /&gt;&lt;br /&gt;The programming model that came to my mind was as follows:&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;UI happens in HTML in the Browser (no back and forth postbacks for updating the UI).&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Navigation happens in the Browser (no need to go to the server to navigate to a&amp;nbsp;new page).&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;You only go to the server for &lt;strong&gt;Business&amp;nbsp;Processing&lt;/strong&gt; and &lt;strong&gt;Data&lt;/strong&gt;. (Well, this is kind of like AJAX)&lt;br /&gt;&lt;br /&gt;Wait a second; now that I think of it, this model reminds me of something!&amp;nbsp; Hmmm...&lt;br /&gt;This looks a lot like Smart Client Application, or Silverlight, but developed in HTML.&amp;nbsp; Wow, what do you know, the programming models for &lt;strong&gt;Business Applications&lt;/strong&gt; are merging ...&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Of course, none of the tools of the time supported the model I had in mind very well.&lt;br /&gt;&lt;br /&gt;In my opinion, &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; takes a huge step in the right direction.&amp;nbsp; However, it is not quite there yet.&amp;nbsp; &lt;br /&gt;For instance, regarding Navigation, when you initiate a POST or a GET from the browser, it is the decision of the browser where to put the returning HTML.&amp;nbsp; This does not seem to sit so well with the notion that the &lt;strong&gt;ASP.NET MVC Controller&lt;/strong&gt; decides which &lt;strong&gt;View&lt;/strong&gt; to render on the server.&lt;br /&gt;Furthermore, if your navigation is done from the server by Rendering a new &lt;strong&gt;View&lt;/strong&gt;, does this mean that we will go back to whole pages refreshing every time you go to the server?&amp;nbsp; I thought we were on the verge of resolving this problem with AJAX.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ASP.NET MVC&lt;/strong&gt; is &lt;strong&gt;NOT&lt;/strong&gt; &lt;strong&gt;ASP.NET&lt;/strong&gt;!&amp;nbsp; In all the blog posts and presentations I saw coming out from Microsoft about &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; they make a point to say that it is an extension on top of &lt;strong&gt;ASP.NET&lt;/strong&gt; and that the two models will play well together.&amp;nbsp; I think that in reality, this is not the case.&amp;nbsp; If the&amp;nbsp;&lt;strong&gt;ASP.NET MVC&lt;/strong&gt; programming model catches on, it will completely deprecate &lt;strong&gt;ASP.NET&lt;/strong&gt;.&amp;nbsp; &lt;strong&gt;ASP.NET&lt;/strong&gt; is about the controls and their event handling model.&amp;nbsp; But the &lt;strong&gt;ASP.NET&lt;/strong&gt; controls are a no no in &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; because no Post Back is allowed (or supported).&amp;nbsp; This is just the same as the fact that you can still use &lt;strong&gt;ASP&lt;/strong&gt; style programming in your &lt;strong&gt;ASP.NET pages&lt;/strong&gt;, however, no one in their right mind does.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ASP.NET MVC&lt;/strong&gt; does a great job in regard to &lt;strong&gt;&amp;quot;Separation Of Concerns&amp;quot;&lt;/strong&gt;.&amp;nbsp; However, when I originally learned about the &lt;strong&gt;MVC Pattern&lt;/strong&gt; it was suggested that an implementation would allow&amp;nbsp;sharing the business part of the application between Web and WinForms based UI implementations of the same application.&amp;nbsp; I am not sure &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; is suitable for this (or was intended to do this).&amp;nbsp; So, this brings up a couple of questions:&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Is it possible to share the business part of the application between a WinForms implementation and a Web implementation of the UI?&amp;nbsp; How much customization would that require?&lt;/li&gt;
&lt;li&gt;How much further does the model need to be changed to support this inherently?&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;
&lt;p&gt;In summary, I would l to say that these are just my thoughts.&amp;nbsp; I hope that they will contribute to a fruitful discussion and to a better implementation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;---&lt;/p&gt;
&lt;p&gt;Adar Wesley&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>