最近看了一些关于MCV模式的资料,晕晕呼呼的,从刚开始学.net,就在网上或书上一大堆介绍.net WebForm开发方式是如何如何的好,如何如何的方便,代码如何如何的分离,吹得跟神一样,而现在呢,出来一个MVC,服务器端控件不提倡用了(不知道还能不能用),aspx.cs事件驱动没了,变成了在什么Controller中有个Action的东东(应该跟java一样),列表绑定需要自己写代码(感觉跟Asp或java的用法差不多,虽然没用过),然后又是一堆人出来吹需MVC是如何如何的好,代码是如何如何的简洁,控件是如何如何的灵活,生成后的代码是如何如何的干净个人觉得做一网站,后台可用以前的WebForm,用控件等,前台可以用所谓的MVC(虽然目前还没用过),如果做企业内部系统,还是用WebForm的方便,总之不要为了MVC而MVC.大家如何看的呢?
就像ajax·~ 唉~`
1.MVC真的是大家吹出来的,如你所说。
2.你没弄明白MVC,所以这样说。
代码简洁
看着就舒服些
直接学习ASP.NET的MVC确实有点难度
在java里面MVC真的是不错
asp.net里面我个人也不是很精通,目前个人看法是没什么新颖的,只是思想的东西
分层
简洁?随便开个开源的MVC软件就看到乱七八糟的代码.<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title><%=XuShop.Models.web.Language.GetValue("19","ec") %></title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta name="keywords" content="XuShop" />
<meta name="description" content="XuShop" />
<link href="<%=("/skin/"+XuShop.Models.web.Language.L+"/0/css/style_960.css") %>" rel="stylesheet" />
<link href="<%=("/skin/"+XuShop.Models.web.Language.L+"/0/css/shopping.css") %>" rel="stylesheet" />
<script src="/javascript/myJSFrame.js" type="text/javascript"></script>
<script type="text/javascript">
function addRowClass(obj) {
$(obj).addClassName("heightline");
}
function removeRowClass(obj) {
$(obj).removeClassName("heightline");
}
</script>
<style type="text/css">
.heightline{background-color:red;}
</style>
</head>
<body>
<div id="wrapper">
<!-- header start -->
<% Html.RenderPartial("Header"); %>
<!-- header end -->
<!-- container start -->
<div id="container">
<!-- myorders start -->
<div id="user">
<h2 id="user-title"><%=XuShop.Models.web.Language.GetValue("47","ec") %></h2>
<ul id="user-tabs">
<li class="current"><a href="/order/"><span><%=XuShop.Models.web.Language.GetValue("48","ec") %></span></a></li>
<li><a href="/my/profile"><span><%=XuShop.Models.web.Language.GetValue("49","ec") %></span></a></li>
<li><a href="/Favorite"><span><%=XuShop.Models.web.Language.GetValue("50","ec") %></span></a></li>
<li><a href="/My/Products"><span><%=XuShop.Models.web.Language.GetValue("51","ec") %></span></a></li>
</ul>
<div id="user-content">
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" class="table-border">
<tr class="table-header">
<th width="16%">
<%=XuShop.Models.web.Language.GetValue("52","ec") %>
</th>
<th width="16%">
<%=XuShop.Models.web.Language.GetValue("53","ec") %>
</th>
<th width="16%">
<%=XuShop.Models.web.Language.GetValue("54","ec") %>
</th>
<th width="16%">
<%=XuShop.Models.web.Language.GetValue("55","ec") %>
</th>
<th width="">
<%=XuShop.Models.web.Language.GetValue("56","ec") %>
</th>
</tr>
<%List<XuShop.Models.common.ordersInfo> ois = ViewData["orders"] as List<XuShop.Models.common.ordersInfo>;
foreach (XuShop.Models.common.ordersInfo oi in ois)
{ %>
<tr class="table-tdbg" onmouseover="addRowClass(this)" onmouseout="removeRowClass(this)">
<td align="center">
<a href='/order/details/<%=oi.OrdersID %>'>
<%=oi.OrdersID%></a>
</td>
<td align="center">
$<%=oi.TotalPrice.ToString("c").Remove(0,1) %>
</td>
<td align="center">
<%=oi.datecreated %>
</td>
<td align="center">
<% if (oi.PaymentMethod == "cod")
{%>
<%=XuShop.Models.web.Language.GetValue("22","ec") %>
<%}
else if (oi.PaymentMethod == "creditcard")
{%>
<%=XuShop.Models.web.Language.GetValue("23","ec") %>
<%}
else
{%>
<%=XuShop.Models.web.Language.GetValue("80","ec") %>
<%} %>
</td>
<td>
<a href='/order/details/<%=oi.OrdersID %>'>
<%=oi.TargetPage %></a>
<%if (oi.TargetPage == "未付款" && oi.PaymentMethod == "creditcard")
{%>
<a href='/ShoppingCart/PayOrder/<%=oi.OrdersID %>'><%=XuShop.Models.web.Language.GetValue("57","ec") %></a>
</td>
<%}%>
</tr>
<%}%>
</table>
<!-- pages start -->
<%if( int.Parse(ViewData["PageQty"].ToString()) > 1) {%>
<div class="pages">
<table border="0" align="center" cellpadding="0" cellspacing="0" class="pages-table">
<tr>
<td>
<div class="pages-div">
<span><%=XuShop.Models.web.Language.GetValue("58","ec") %>
<%=ViewData["Qty"] %>
<%=XuShop.Models.web.Language.GetValue("46","ec") %></span> <span><%=XuShop.Models.web.Language.GetValue("59","ec") %><%=ViewData["PageIndex"] %>/<%=ViewData["PageQty"] %></span>
<a href='/Order/List/<%=ViewData["catid"] %>?page=<%=ViewData["PreviousPageIndex"]%>'>
<%=XuShop.Models.web.Language.GetValue("60","ec") %></a> <a href='/Order/List/<%=ViewData["catid"] %>?page=<%=ViewData["NextPageIndex"]%>'>
<%=XuShop.Models.web.Language.GetValue("61","ec") %></a></div>
</td>
</tr>
</table>
</div>
<%} %>
<!-- pages end -->
</div>
</div>
<!-- myorders end -->
</div>
<!-- container end -->
<!-- footer start -->
<% Html.RenderPartial("Footer"); %>
<!-- footer end -->
</div>
</body>
</html>
看来winner2050兄还是比较喜欢用WebForm,至少目前为止?
其实asp.MVC还是挺好的开发模式
我恶心 <%= %>这种代码,喜欢<%# %>这种代码。呵呵,不是代码,而是思想完全不同。
mvc在用户较多时,速度稍微快些。
中小网站还是用webform
MVC更像是asp+HttpModule,其实更接近逻辑分层的本质
而WebForm本质就是个HttpHandler
WebForm配置简单,易于理解,MVC则相反
并且MVC前台嵌入代码让习惯拖控件的人难以忍受
做过url重写的人学习MVC会很轻松
两者各有各的优势
一般大型企业的后台管理系统 都会采用MVC模式