您的位置:首页 > 移动开发 > Unity3D

ASP.NET Mvc + NHibernate + Unity Application Block 示例程序

2010-11-01 23:04 429 查看
今天无意间看到了Unity Application Block (以下简称Unity),感觉很不错,用起来挺方便的说。于是一时兴起写了这个留言本的小示例。数据库操作采用的NHibernate,UI直接用的

ASP.NET Mvc了。项目基于VS2010 + SQLServer 2005 ,就一个表的增删改查操作很简单。目的是为了体验下Unity的Ioc功能。

国际惯例,先上个项目结构图

代码

<%foreach(var item in Model){ %>
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<th>姓名</th>
<th style="background-color:White"><%=item.GuestName %></th>
<th>性别</th>
<th style="background-color:White"><%=item.Sex==1?"男":"女" %></th>
</tr>
<tr>
<td colspan="4" height="50" valign="top">
<%=item.GuestMessage %>
</td>
</tr>
<tr>
<td colspan="4"><%=Html.ActionLink("删除","Delete",new{sysno=item.SysNo}) %></td>
</tr>
</table>
<%} %>

最后放一张运行的图片,其它的Save,Delete方式其本相同,这里就不多讲了。大家可以在这里下载源码(已上传)。



Tag标签: Unity,Unity Application Block,Ioc,NHibernate,ASP.NET Mvc,分层,架构
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: