week 2 - intro to visual studio 2008
TRANSCRIPT
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
1/30
Developing WebApplications Using
Microsoft Visual
Studio 2008
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
2/30
Module 2: Creating Web Applications by Using MicrosoftVisual Studio 2008 and Microsoft .NET-Based Languages
Overview of Visual Studio 2008
Creating an ASP.NET Web Application Project
Overview of the Microsoft .NET-Based Languages
Creating a Component by Using Visual Studio 2008
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
3/30
Lesson: Overview of Visual Studio 2008
Why Visual Studio 2008?
Available Project Templates
Integrated Development Environment
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
4/30
Why Visual Studio 2008?
One IDE for multiple languages and multiple project types
Multiple languages in a project
Multiple project types within a solution
Support for applications that target multiple versions ofthe .NET Framework
Integrated browser
Debugging support
Customizable interface
WPF, WCF, and Workflow designer and project support
ASP.NET AJAX and LINQ
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
5/30
Available Project Templates
The list of available project templates is based on
your Project type and Template selections
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
6/30
Editor Object Browser
SolutionExplorer
ServerExplorer
Toolbox
Dynamic Help
Properties
Task List
Integrated Development Environment
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
7/30
Lesson: Creating an ASP.NET Web Application Project
The Development Process
Web Application Types and File Structure
Web Application Files
Demonstration: Creating a Web Application Project
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
8/30
Deploy
Create a DesignSpecification
Create the Interfaceand Write CodeCreate a NewProject Test andDebug
Build
The Development Process
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
9/30
ASP.NET Web Application
project template
Similar projectstructure toVisual Studio 2003
Provides tighter control
over a project
ASP.NET Web Siteproject template
Easier to use
Provides more featuresand additional flexibility
Web Application Types and File Structure
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
10/30
Web Application Files
Web application files
ASP.NET Web Forms (.aspx)
ASP.NET Web services (.asmx)
Classes and code-behind pages (.vb or .cs)
Global application classes (.asax)
Web.config file
Other files
Files not based on a programming language
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
11/30
Demonstration: Creating a Web Application Project
Populate the ASP.NET Web Form
Add a new ASP.NET Web Form
Add a new project
Write code for the Button control
Build and debug the solution
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
12/30
Notes Page Over-flow Slide. Do Not Print Slide.See Notes pane.
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
13/30
Notes Page Over-flow Slide. Do Not Print Slide.See Notes pane.
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
14/30
Lesson: Overview of the Microsoft .NET-BasedLanguages
Multiple Language Support
The Common Language Runtime
Runtime Compilation and Execution
What Are Namespaces?
Comparison of the Microsoft .NET-Based Languages
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
15/30
Multiple Language Support
The .NET Framework supports many languages
More than 20 languages currently supported
Microsoft provides languages such as Visual Basic,Visual C# and C++
Benefits of multiple-language support
Code modules are reusable
API access is the same for all languages
The right language is used for the right task
Performance is roughly equal between all languages
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
16/30
The Common Language Runtime
One runtime for all .NET-based Languages
Manages threads and memory
Garbage collection
Enforces code security
Eliminates DLL versioning problems Multiple versions of a DLL can run simultaneously
Applications can specify a version of a DLL to use
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
17/30
Visual Basic
code
Visual C#
code
Runtime Compilation and Execution
Whichlanguage
?
Visual C#compiler
Visual Basiccompiler
MSIL
Nativecode
Runtime
JIT compiler
HTML
Default.aspx
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
18/30
What Are Namespaces?
Group related classes
Logical, not physical, grouping
Namespaces are hierarchical
Decrease naming conflicts
Keyword: using (Visual C#), Imports (Visual Basic)
Implicit and explicit object declaration
[Visual C#]using System.Data.SqlClient;
[Visual Basic]Imports System.Data.SqlClient
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
19/30
Comparison of the Microsoft .NET-Based Languages
.NET Framework class library is the same regardless of
language Performance
All languages are compiled to MSIL
Only performance difference is how each language compilercompiles to MSIL
The runtime compiles all MSIL the same, regardless of itsorigin
Development experience
Visual C# is appropriate for Java, C, and Visual C++developers
Visual Basic is appropriate for Visual Basic 6.0 developers
Browser compatibility
ASP.NET code is server-side code, so browser compatibility isnot an issue
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
20/30
Lesson: Creating a Component by UsingVisual Studio 2008
What Are Classes and Components?
Creating a Class
Accessing Components in an ASP.NET Web Form
Demonstration: Creating a Class in Visual Studio 2008
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
21/30
What Are Classes and Components?
Classes are groups of code with no user interface
Components are compiled classes
Components are compiled as DLL files
Components are used for sharing code betweenapplications
Webapplication
Webapplication
Windowsapplication
Component
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
22/30
Creating a Class
Create a Class Library project in Visual Studio 2008
Visual Studio 2008 creates a default namespace
Create methods of the class
[Visual Basic]Public Class ShippingFunction CalShipping (ByVal price As Single) As Single...Return (cost)
End FunctionEnd Class
[Visual C#]public class Shipping{
public Single CalShipping (Single price){...return cost;
}}
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
23/30
Namespace CompanyAClass ShippingFunction CalShipping ()
End ClassEnd Namespace
namespace CompanyA{class Shipping{public void CalShipping () { }
}}
[Visual Basic]Dim shippingObject As New _CompanyA.Shipping
Add a reference to the DLL
Instantiate the class object:
Use the object:
[Visual C#]CompanyA.Shipping shippingObject =new CompanyA.Shipping();
cost =shippingObject.CalShipping(price);
cost = _shippingObject.CalShipping(price)
Accessing Components in an ASP.NET Web Form
component.dll component.dll
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
24/30
Demonstration: Creating a Class in Visual Studio 2008
Create a new Class Library project
Create a method that returns a string
Call the class from an ASP.NET page
Create a class in the App_Code folder
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
25/30
Notes Page Over-flow Slide. Do Not Print Slide.See Notes pane.
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
26/30
Notes Page Over-flow Slide. Do Not Print Slide.See Notes pane.
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
27/30
Lab: Creating Web Applications by Using MicrosoftVisual Studio 2008 and Microsoft .NET-Based Languages
Exercise 1: Creating an ASP.NET Web Site
Exercise 2: Creating a Class
Exercise 3: Calling the Component
Logon information
Virtual machine 2310C-LON-DEV-02
User name Student
Password Pa$$w0rd
Estimated time: 40 minutes
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
28/30
Lab Scenario
Medicalmedical.aspx
BenefitsHome PageDefault.aspx
Life Insurancelife.aspx
Retirementretirement.aspx
Dentistsdental.aspx
Doctorsdoctors.aspx
Logon Pagelogin.aspx
Registrationregister.aspx
Prospectus
prospectus.aspxXML WebServiceDentalService1.asmx
Page Headerheader.ascx
Lab WebApplication
User ControlnameDate.ascx
Menu ComponentBenefits.cs or Benefits.vb
Master Page
benefitsMaster.master
LINQ to SQLClassesDoctors.dbml
ASPState
DentistsDoctorsXML Files
Web.
config
TempDB
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
29/30
Lab Review
Review Questions
How did you create a Web site?
When you create a Web site, what folders or files doesSolution Explorer display?
Can you think of a reason why Default.aspx has an
associated code-behind file?
How can you add projects to a Web site?
What type of references can you add to your Web site?
-
8/7/2019 Week 2 - Intro to Visual Studio 2008
30/30
Module Review and Takeaways
Review Questions
Real-World Issues and Scenarios
Tools