Visual Basic NET and SQL Server


366 47 4MB

English Pages 210 Year 2000

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Trademarks......Page 1
Foreword......Page 2
Target Audience of This Book......Page 3
Why .NET Component Services......Page 4
Organization of This Book......Page 5
Acknowledgments......Page 6
COM......Page 7
SQL Server......Page 8
.NET Features......Page 9
Listing 1.1 A Simple Serviced Component in Visual Basic .NET......Page 10
Configurable Isolation Level......Page 11
Visual Basic .NET......Page 12
New “Problems” with Visual Basic .NET......Page 13
C# Versus Visual Basic .NET......Page 14
User-Defined Functions......Page 15
Outstanding Problems with SQL Server 2000......Page 16
References......Page 17
Type of Consumer......Page 18
Figure 2.2. Deployment schema for when Web Forms are the consumer.......Page 19
Figure 2.3. Deployment schema for when Windows Forms are the consumer.......Page 20
Listing 2.2 UPDATE Where "Complete" Comparison Is Used......Page 21
Figure 2.5. Sample configuration of n application servers connected to one database server.......Page 22
The Importance of Test Results......Page 24
Scalability......Page 25
Scaling Up and Scaling Out......Page 26
Using the Database......Page 27
Maintainability......Page 28
Figure 2.7. A house of cards is an obvious example of something with low maintainability.......Page 29
Using Recovery/Fail Over When a Problem Occurs......Page 30
Figure 2.8. Example of an architecture where the stored procedures can't be reused without also reusing the components in the business logic layer.......Page 31
Testability......Page 32
Interoperability......Page 33
Listing 2.4 Finding the Name of the Calling Method......Page 34
Farm- and Cluster-Enabling......Page 35
Figure 2.10. Cloning.......Page 36
The DeMilitarized Zone (DMZ) in Software Architecture......Page 37
Figure 2.13. Replication.......Page 38
Figure 2.14. Shared disk clustering.......Page 39
Caching and Clustering......Page 40
References......Page 41
Considering the Testing Level......Page 42
Code Reviewing......Page 43
Stress Testing......Page 44
Support for Automatic Testing with a Standardized Test Bed......Page 45
Test Driver, Test Bed, and Test Suite......Page 46
Figure 3.1. An overview of test executions based on the current filter.......Page 47
Registration and Execution......Page 48
Understanding the Database Schema for the Test Bed......Page 49
Using the Test Driver to Test Stored Procedures......Page 50
Listing 3.3 Example of a Test Driver for Stored Procedures: Part 3......Page 51
Listing 3.5 Example of a Component Test Driver......Page 52
Understanding the Controller of the Test Bed......Page 53
Writing the Test Drivers: Issues to Consider......Page 54
Assertions......Page 56
Getting the Basic Idea......Page 57
Understanding Class Invariants......Page 58
Listing 3.12 Customized Assert() Method......Page 59
Listing 3.14 Stored Procedure Version of Assert()......Page 60
Summing Up: Final Thoughts About Assertions......Page 61
Evaluation of the Test Bed Proposal......Page 62
References......Page 63
Tracing in the Dark Ages......Page 64
Listening......Page 65
Listing 4.4 Using a .config File Where TraceLevel Is Set to Warning (Including the Lower Level Error)......Page 66
Categorization......Page 67
Receiver......Page 68
Remote Receiver......Page 69
Configuration......Page 70
Listing 4.8 Making a Trace Call in a Stored Procedure......Page 71
Implementation Option 3: Extended Stored Procedure......Page 72
Start and Stop Tracing During Production......Page 73
Different Signatures......Page 74
Listing 4.12 Example of How to Use String.Format()......Page 75
Listing 4.15 An Example of a Public Trace Method (in This Case, TraceMessage())......Page 76
Listing 4.16 The Protected Trace Method That All Public Trace Methods Call......Page 77
Checking the Solution Against the Requirements......Page 78
The Built-In Logging Solution in .NET......Page 79
My Proposal for a Logging Solution......Page 80
General Stored Procedures......Page 81
Listing 4.18 The Stored Procedure That Creates a New Transaction Before Logging......Page 82
Creating the Error Stack......Page 83
Figure 4.7. Class diagram showing the Err and the ServicedErr classes.......Page 84
Custom Attributes Helping to Generate Code......Page 85
Listing 4.22 Get the Description of the Values of an Enum Variable......Page 86
Configuration Data......Page 87
Dealing with Configuration Data in VB6......Page 88
Using the Registry......Page 89
Using a .config File......Page 90
Listing 4.27 Reading a Value That Is Stored in the SPM......Page 91
Using Object Pooling (OP)......Page 92
Evaluation of the Tracing Proposal......Page 93
References......Page 94
Example 1: The Database-Independent and Pure Object-Oriented Architecture......Page 95
Figure 5.1. Classic Windows DNA tiers: Presentation, Business Logic, and Data.......Page 96
Sample Application Requirements......Page 97
My Proposal: Building Blocks......Page 98
Stored Procedures......Page 99
My Architecture Proposal Tier-by-Tier and Layer-by-Layer......Page 100
Proposal Used for Sample Application Acme HelpDesk......Page 101
Consumer Layer......Page 102
Hiding Consumer-Side Caching......Page 103
Figure 5.5. Example of a Consumer Helper class.......Page 104
Figure 5.6. Example of a class in the Application layer.......Page 105
Figure 5.7. Example of a class in the Domain layer.......Page 106
Figure 5.8. Example of a class in the Domain layer when Shared methods are used.......Page 107
Figure 5.9. Example of a class in the Persistent Access layer.......Page 108
Figure 5.10. Example of a class in the Persistent Access layer, only with Shared methods.......Page 109
Public Stored Procedures Layer......Page 110
Tables, Views, and User-Defined Functions......Page 111
Figure 5.13. An XML Web service and my proposed architecture.......Page 112
Figure 5.15. An ASP.NET application and the proposed architecture.......Page 113
Dispose()......Page 114
Recommend Papers

Visual Basic NET and SQL Server

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

)URQW3LHFH 1(7(QWHUSULVH'HVLJQZLWK9LVXDO%DVLFŠ1(7DQG64/ 6HUYHU -LPP\1LOVVRQ 3XEOLVKHU6DPV3XEOLVKLQJ )LUVW(GLWLRQ'HFHPEHU ,6%1SDJHV

7KHRQO\ERRNWKDWXVHV9LVXDO%DVLF1(764/6HUYHUDQG1(7 WRSURYLGHVWUDWHJLHVIRUVROYLQJWKHNH\SUREOHPVGHYHORSHUV HQFRXQWHUZKHQGHVLJQLQJFRPSRQHQWVHUYLFHVIRUHQWHUSULVH DSSOLFDWLRQV x x

x

0RVWXSWRGDWHFRYHUDJHDYDLODEOHDERXW9%1(71(7 FRPSRQHQWVHUYLFHVDQG64/6HUYHU 8VHVDVRIWZDUHHQJLQHHULQJDSSURDFKWRGLVFXVVKRZWRXVH YDOXDEOHWHFKQLTXHVWRVROYHNH\SUREOHPVIDFHGZKHQGHDOLQJ ZLWKFRPSOH[GLVWULEXWHGV\VWHPV 'HWDLOHGGLVFXVVLRQRIWKHSURVDQGFRQVIRUHDFKSRWHQWLDO VROXWLRQE\ORRNLQJDWLVVXHVVXFK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