1、打开vs2005:开始->程序->Microsoft Visual Studio 2005 -> Visual Studio 2005.exe 启动程序

2、文件 - 新建 - 项目 :打开“新建项目”对话框,选择“其他项目类型”- Visual Studio 解决方案 - 选择右侧的“空白解决方案”,然后在“名称”处填写项目的名称,如Test,“位置”处填写项目保存的位置,如:E:\asp.net,这样创建的项目解决方案就保存在:E:\asp.net\Test,你可以打开文件夹查看,Test目录下有个项目启动文件:Test.sln

 3、创建数据库所需的EntityDesigns:文件- 添加 - 新建项目,弹出“新建项目”对话框,左边选择“其他语言”下面的Visual C#,然后在右边对应的列表中选择“类库”,然后在下面“名称”中填写EntityDesigns,按“确定”进行保存。至此,在E:\asp.net\Test下多了一个EntityDesigns文件夹,同时在VS2005中,会自动在EntityDesigns下创建一个Class1.cs文件,将次文件重命名改成EntityDesigns.cs。

由于EntityDesigns在设计数据库表的时候需要引用NBear.Common.Design,因此,右键单击EntityDesigns后选择“添加引用”,点击“浏览”后定位到dist文件夹选择NBear.Common.Design。

4、创建程序操作数据库的实体类Entities:创建方式和EntityDesigns一样,最后将Class1.cs改成Entities.cs。

同样,按照第三步骤中为Entities添加NBear.Common。

//开发B/S构架系统

5、接下来创建表现层,也就是应用程序;如果我们开发B/S构架的系统,那就通过点击菜单“文件”-“添加”-“新建网站”,然后在弹出窗口“添加新网站”选择“ASP.NET 网站”,下面位置的地方选择“ E:\asp.net\Test\Web”,点击“确定”,至此创建成功。

6、创建Web成功后在E:\asp.net\Test下多了个Web文件夹,这个就是我们接下来要实现页面功能实现的地方。首先,我们为将要开发的系统创建一个Web.config,主要是负责程序和数据库之间的沟通以及其他基础配置。我们通过右键单击“解决方案资源管理器”中的Web文件夹,点击“添加新项(W)“后在弹出菜单中选择“Web 配置文件”,默认的文件名字就是Web.Config,点击确定。

 以下是Web.Config 的文件内容,稍作修改就直接可以使用:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<configSections>
		<section name="entityConfig" type="NBear.Common.EntityConfigurationSection, NBear.Common" />
		<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
	</configSections>
	<appSettings />
	<connectionStrings>
  <add name="Test" connectionString="Data Source=localhost;Initial Catalog=Apwms;Persist Security Info=True;User ID=sa;Password=0000" providerName="System.Data.SqlClient" />

 </connectionStrings>
	<system.web>
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="zh-CN" uiCulture="zh-CN" />
		<httpHandlers>
			<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2" />
		</httpHandlers>
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
		<compilation debug="true">
			<assemblies>
				<add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies>
		</compilation>
    
    
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
		<authentication mode="Windows" />
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
	</system.web>
	<entityConfig>
		<includes>
			<add key="Sample" value="~/EntityConfig.xml" />
		</includes>
	</entityConfig>
    
</configuration>
7、在Web目录下添加EntityConfig.xml文件,主要存储数据库各表和对应表中的各个字段信息,该文件内容由dist文件中的NBear.Tools.EntityDesignToEntity.exe生成。接下来会详细介绍。
8、创建数据库:Test。打开sql server 2005 management studio ,登录成功后右键点击“数据库”后选择“新建数据库”进行创建。
9、打开Web文件夹下的Default.aspx文件,在<div></div>中随便输入几个字符,如Hello。。。,然后按ctrl + s 进行保存,按F5进行预览。
posted on 2010-05-16 20:36  蒂非特软件  阅读(330)  评论(0)    收藏  举报