Tải bản đầy đủ (.pdf) (7 trang)

Setup and Configuration

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (145.82 KB, 7 trang )


Design Pattern Framework™ 2.0
Setup and Configuration

Solution setup:
The solution includes class libraries, a Web Application, a Web Service, and a Windows
Application. We recommend you copy the entire Patterns in Action 2.0 solution to the
following folders:

For the C# edition:
C:\Program Files\DoFactory\Design Pattern Framework 2.0 CS\Patterns in Action\
For the VB edition:
C:\Program Files\DoFactory\Design Pattern Framework 2.0 VB\Patterns in Action\

Your folder structure should look like this:

Figure 1: Solution folders
Copyright © 2006, Data & Object Factory. All rights reserved. Page 9 of 66

Design Pattern Framework™ 2.0
Double click on the solution file named “Patterns In Action.sln“ and Visual Studio 2005
launches with the solution open.

Once in Visual Studio 2005, you can select one of two Startup Projects.

1) To run the Web Application select the \Web\ application as the Startup Project (it
will show in bold). See below.





2) Alternatively, you can run the Windows Application (a web service consumer) by
selecting the WindowsSOAClient project as your Startup Project. See below.



Copyright © 2006, Data & Object Factory. All rights reserved. Page 10 of 66

Design Pattern Framework™ 2.0
Database Setup:
Patterns in Action 2.0 supports two databases: MS Access and SQL Server. By default
the application runs against a local MS Access database called Action.mdb. This
database resides in the standard ASP.NET 2.0 data folder named \App_Data\. See
image below. A second copy of the database resides in \App_Data\ under the Web
Service project.




To configure Patterns in Action 2.0 to run against a Sql Server database is easy. These
are the steps: First, create an empty database named Action (or a similar name).
Second, run the scripts named Action.sql against this new database. This will create the
data model and enter the required data in the database. You can find the Action.sql file
in the .NET solution under a folder named \Solution Items\Sql Server\. See image below.
Finally, you will need to adjust your web.config file (described in the next section on
web.config) and you’re ready to go. Please note that the entire solution has two
web.config files: one for the Web Site and another for the Web Service. If you change
one, you most likely want to change the other as well.

Copyright © 2006, Data & Object Factory. All rights reserved. Page 11 of 66


Design Pattern Framework™ 2.0


For .NET developers using Oracle, some placeholder data access code for Oracle is
included. The port to Oracle will be easy because the application uses no database
specific SQL or stored procedures. You will need to program the Oracle specific data
access components, but again, this will be easy because the SQL is identical to the SQL
used in Sql Server. Finally, you will need to build and populate the Oracle database.

Web.config Setup:
Web.config is the configuration file for ASP.NET web sites and web services. In this file,
you configure your database and several other custom application options. The most
important items are listed below.

<appSettings>
<!-- Provider. Options are: System.Data.OleDb, System.Data.SqlClient,
or System.Data.OracleClient -->
<add key="DataProvider" value="System.Data.OleDb"/>

<!-- Log Severity. Options are: Debug, Info, Warning, Error,
Warning, or Fatal -->
<add key="LogSeverity" value="Error"/>

<!-- Default Shipping Method. Options are: Fedex, UPS, or USPS -->
<add key="ShippingMethod" value="Fedex"/>
</appSettings>
Copyright © 2006, Data & Object Factory. All rights reserved. Page 12 of 66

Design Pattern Framework™ 2.0


<!-- Connection string settings -->
<connectionStrings>
<add name="System.Data.OleDb"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=|DataDirectory|action.mdb"/>
<add name="System.Data.SqlClient"
connectionString="Server=(local);Initial Catalog=Action;User
Id=sa;Password=secret;"/>
<add name="System.Data.OracleClient"
connectionString="Data Source=MyOracleActionDB;User
Id=scott;Password=tiger;Integrated Security=no;"/>
</connectionStrings>

The default database is MS Access for which System.Data.OleDb is the data provider.
Valid DataProvider values and their database mapping are:

• System.Data.OleDb is used for MS Access,
• System.Data.SqlClient is used for Sql Server, and
• System.Data.OracleClient is used for Oracle.

To use Sql Server, for example, you set DataProvider to System.Data.SqlClient. Be
sure that the associated connectionstring (under the <connectionStrings> section) for
the System.Data.SqlClient is correct. At a minimum, you must adjust the User Id and
Password. Similarly, if you wish to run against Oracle set the proper DataProvider and
associated connectionString.

Two application settings are configured in web.config: they are LogSeverity and
ShippingMethod.

With LogSeverity you specify at what level error messages should be logged by the

Logging system. For example if the log severity level is ‘Warning’, and a log message of
level ‘Error’ is issued by the application, then it is logged (because the severity for a
‘Error’ is higher than or equal to Warning). A log message with severity level ‘Info’ will
not be logged. Logging is explained later in this document.
Copyright © 2006, Data & Object Factory. All rights reserved. Page 13 of 66

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×