Top Banner

of 57

Chapter 2 - .NET Component

May 30, 2018

Download

Documents

phannarith
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/9/2019 Chapter 2 - .NET Component

    1/57

    .NET Components

    Main Menu 1 of 57

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    2/57

    .NET Components

    Main Menu 2 of 57

    Objective

    At the end of this chapter students will be able to

    understand different .NET components of the .NET

    Framework

  • 8/9/2019 Chapter 2 - .NET Component

    3/57

    .NET Components

    Main Menu 3 of 57

    Scope

    Introduction

    Visual Studio .NET

    Shared Integrated Development Environment

    Different windows of Visual Studio .NET

    Windows Management

    Languages

    Technology

  • 8/9/2019 Chapter 2 - .NET Component

    4/57

    .NET Components

    Main Menu 4 of 57

    Introduction

    The .NET Framework is language-neutral; virtually

    any language can target the .NET Framework. .NET

    Framework supports a number of languages,

    including C++, Visual Basic .NET, JScript, and C#.A large number of third-party languages will also be

    available for building .NET Framework applications.

    These languages include COBOL, Eiffel, Perl,

    Python, Smalltalk, and others. This chapter willdiscuss the tool, technology and some of the

    languages supported by Microsofts .NET

    Framework.

  • 8/9/2019 Chapter 2 - .NET Component

    5/57

    .NET Components

    Main Menu 5 of 57

    Tools The Microsoft .NET Framework Software

    Development Kit (SDK) tools are designed to make

    application development easier to create, deploy, and

    manage applications and components that target the

    .NET Framework. There are many tools that comewith the .NET Framework SDK. Visual Studio .NET

    is one of the tool that ship with the .NET

    Framework.

  • 8/9/2019 Chapter 2 - .NET Component

    6/57

    .NET Components

    Main Menu 6 of 57

    Visual Studio .NET

    Visual Studio .NET is an upgraded version of Visual

    Studio which has several new features. It combines

    the best of the various IDEs that were previously

    used. The general look and feel is similar to VB 6IDE with a difference

  • 8/9/2019 Chapter 2 - .NET Component

    7/57

    .NET Components

    Main Menu 7 of 57

    Visual Studio .NET

    Unlike previous Visual Studio, in Visual Studio.

    NET, exactly the same IDE is used for all Visual

    Studio .NET compliant languages. This IDE is

    designed to manage projects that accommodate morethan one language at a time.

  • 8/9/2019 Chapter 2 - .NET Component

    8/57

    .NET Components

    Main Menu 8 of 57

    Visual Studio .NET

    Visual Studio .NET is a complete set of

    development tools for building Web based

    applications, XML Web services, desktop

    applications, and mobile applications. VisualBasic .NET, Visual C++ , and Visual C# all use the

    same integrated development environment (IDE)

  • 8/9/2019 Chapter 2 - .NET Component

    9/57

    .NET Components

    Main Menu 9 of 57

    Shared Integrated Development

    Environment .NET Framework supported languages are hosted

    within the Visual Studio .NET integrated

    development environment. Sharing a single IDE fora range of language provides many advantages like

    without exiting the open project which may be

    written in Visual Basic one can start writing code

    using another language like C#.

  • 8/9/2019 Chapter 2 - .NET Component

    10/57

    .NET Components

    Main Menu 10 of 57

    Start Page of Visual Studio .NET

    Start Page provides a quick way to set the user

    preferences including keyboard scheme, windows

    layout and help filter as shown below. It will also

    allow setting the startup page when the VisualStudio starts and many other features.

  • 8/9/2019 Chapter 2 - .NET Component

    11/57

    .NET Components

    Main Menu 11 of 57

    Start Page of Visual Studio .NET

  • 8/9/2019 Chapter 2 - .NET Component

    12/57

    .NET Components

    Main Menu 12 of 57

    Start Page of Visual Studio .NET With the help of Start Page one can also view the

    latest articles, events, topics on .NET and many

    other services like where to host web services etc..,

    on the internet via the link provided on the left side

    of the screen. Start Page also gives the links to the

    latest project being developed in addition to the

    option of creating of new project and opening an

    existing project. Within IDE a web page can also bedisplayed using View -> Show Browser -> Web

    Browser menu. When the button with the label

    New Project selected the following window will

    appear:

  • 8/9/2019 Chapter 2 - .NET Component

    13/57

    .NET Components

    Main Menu 13 of 57

    Start Page of Visual Studio .NET

  • 8/9/2019 Chapter 2 - .NET Component

    14/57

    .NET Components

    Main Menu 14 of 57

    Start Page of Visual Studio .NET

    The left side of this screen gives the option to

    choose the type of the project to be created.

    Depending on the options selected during

    installation of Visual Studio environment, one canchoose from a Visual Basic .NET, C#, C++, and

    possibly other programming languages.

  • 8/9/2019 Chapter 2 - .NET Component

    15/57

    .NET Components

    Main Menu 15 of 57

    Start Page of Visual Studio .NET

    The right side of this screen, gives the option to

    choose a default template for the type of project that

    will be created. There are many different templates

    to choose from. The table given below provides alist of some of these project template types.

  • 8/9/2019 Chapter 2 - .NET Component

    16/57

    .NET Components

    Main Menu 16 of 57

    Start Page of Visual Studio .NETProject Type DescriptionWindows Application Template for creating a normal windows application

    Class Library Template for Creating classes that will be used in other application

    Control Library Template for creating controls that will be used on Windows Forms.

    ASP.NET Web Application Template for creating a Web site with static or dynamicHTML pages asthe user interface.

    ASP.NET Web Services Template for creating Web Services that can be called through XMLSOAP interfaces.

    Web Control Library Template for creating users own controls that will be called from Webapplications.

    Console Application Template creating command-line applications.Windows Services Template for creating users own service that runs in the Windows

    environment.Empty Project/Empty Web project Creates an empty project that a developer can use to build a project. No

    templates supplied.

  • 8/9/2019 Chapter 2 - .NET Component

    17/57

    .NET Components

    Main Menu 17 of 57

    Solution Explorer

    Solution Explorer displays an organized list of

    projects as well as the files and directories that are

    part of the current solution. The solution can consist

    of projects in different languages.

  • 8/9/2019 Chapter 2 - .NET Component

    18/57

    .NET Components

    Main Menu 18 of 57

    Command Window The Command Window is a synergy of a command

    line and Visual Basics immediate window.

    Command Window can be activated by using View -

    > Other Window -> Command Window. CommandWindow has two modesCommand Mode and

    Immediate Mode. The Command Mode is used to

    execute command directly in the Visual Studio .NET

    environment bypassing the other commands whichare executed through the menu option.

    C

  • 8/9/2019 Chapter 2 - .NET Component

    19/57

    .NET Components

    Main Menu 19 of 57

    Command Window

    When the Command Window is in Command Mode

    its title bar displays the text Command Window

    and the greater than symbol (>) appears in the

    window as a prompt for new lines whereas if theCommand window is in Immediate Mode its title bar

    displays the text Command Window Immediate.

    The Immediate Mode is used to execute code

    statements, set or assign values to the variables,evaluate expressions and many more.

    NET C

  • 8/9/2019 Chapter 2 - .NET Component

    20/57

    .NET Components

    Main Menu 20 of 57

    To switch into the Immediate Mode from Command

    mode enter immed into the Command Window

    without the greater than sign (>), whereas to switch

    into the Command Mode from Immediate Modeenter >cmd into the command window.

    Command Window

    NET C

  • 8/9/2019 Chapter 2 - .NET Component

    21/57

    .NET Components

    Main Menu 21 of 57

    Server Explorer

    As the development has become more server-centric,

    developers have a greater need to discover and

    manipulate services on the net. The Server Explorer,

    a new feature of Visual Studio.NET makes it easier.Through this a wide variety of server resources that

    are available for use can be seen as shown below.

    Even services can be restarted and stopped on the

    server using Server Explorer. This window can beselected from View | Server Explorer

    NET C

  • 8/9/2019 Chapter 2 - .NET Component

    22/57

    .NET Components

    Main Menu 22 of 57

    Dynamic Help

    This option can be selected from Help | Dynamic

    Help

    Dynamic Help provides appropriate help on a single

    click. It provides pointers to relevant informationspecific to the current development task.

    NET C t

  • 8/9/2019 Chapter 2 - .NET Component

    23/57

    .NET Components

    Main Menu 23 of 57

    Enhanced IntelliSense

    Web Developers can get immediate help on tags,

    properties and even values within the code editor

    using the IntelliSense technology. Developer can

    gain benefits of automatic statement completion andsyntax notifications when they write their code.

    NET C t

  • 8/9/2019 Chapter 2 - .NET Component

    24/57

    .NET Components

    Main Menu 24 of 57

    Window Management

    Various information windows in Visual Studio.NET

    are dockable. When developers edit multiple

    documents in the editor or designer, all the

    documents appear as tabs on the top. Back andForward button allows developers to navigate

    through the open windows in the environment.

    Visual Studio.NET provides support for multiple

    screens so that more windows can be opened at thesame time without sacrificing screen space.

    NET C t

  • 8/9/2019 Chapter 2 - .NET Component

    25/57

    .NET Components

    Main Menu 25 of 57

    Designer

    Designers can be selected from Tools | Options.

    HTML Designer

    HTML Designer is a graphical way to develop

    HTML pages, ASPs and ASP.NET web forms

    without delving into HTML or script code.

    Windows Forms Designer

    Using the Windows Forms Designer, rich Windows-based applications can be developed.

    NET C t

  • 8/9/2019 Chapter 2 - .NET Component

    26/57

    .NET Components

    Main Menu 26 of 57

    Component Designer

    Server side components can be built quickly andgraphically using the Component Designer of Visual

    Studio.NET. It applies the concepts of RapidApplication Development form-based programmingto build middle-tier objects - a visual way forbuilding non-visual objects.

    Instead of writing lots of server-based code,developers can drag and drop server components tothe design surface that will run on the server.

    Designer

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    27/57

    .NET Components

    Main Menu 27 of 57

    Designer

    XML Designer

    The XML Designer provides tools for working with

    XML and XSD files. Developers can create and edit

    XML files and XSD schemas. Visual Studio .NET does not only have designer for

    visual modules, but components also have a

    designer. With the Component Designer, elements

    from the toolbox can be dragged and dropped onto

    the design surface. They receive a default name and

    have logic automatically generated to integrate them

    into the component.

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    28/57

    .NET Components

    Main Menu 28 of 57

    Web Hosting:

    Developers wanting to deploy web applications and

    XML web services by using Visual Studio.NET will

    be at ease by the inclusion of new Web Hosting tabon the Start page in Visual Studio.NET. The Web

    Hosting tab gives developers access to a list of

    ASP.NET Web hosters to provide free Web space

    and are integrated with Visual Studio.NET to

    facilitate the deployment of completed applications

    through a wizard.

    Other Features

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    29/57

    .NET Components

    Main Menu 29 of 57

    Other Features

    Third-party downloads:

    Hundreds of software component vendors, training

    companies and other partners have already adopted

    and created .NET based software that is available fordevelopers to extend their solutions with Visual

    Studio.NET. These third party resources can easily

    be found on the Whats New tab on the Start page in

    Visual Studio.NET.

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    30/57

    .NET Components

    Main Menu 30 of 57

    Other Features

    It provides a place for developers to learn about the

    new features in Visual Studio.NET as well as a place

    to learn about the third party vendors providing

    developer tools, languages, controls that work withand integrate with Visual Studio.NET.

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    31/57

    .NET Components

    Main Menu 31 of 57

    Other Features

    Efficient Message Delivery:

    Microsoft Message Queuing (MSMQ) makes it easy

    for developers to communicate with the application

    programs quickly, reliably by sending and receivingmessages.

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    32/57

    .NET Components

    Main Menu 32 of 57

    Tools such as Notepad, the built-in XML editor in

    VS.NET can be used to edit the properties and

    change the values.

    Dynamic Property Change

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    33/57

    .NET Components

    Main Menu 33 of 57

    Languages

    This section discusses the Visual Studio .NET

    compliant language. These language include Visual

    C#, Visual Studio .NE and many more.

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    34/57

    .NET Components

    Main Menu 34 of 57

    Visual C#

    Visual C# is a new language which runs inside the

    .NET Framework. It is a simple, modern, object

    oriented and type safe programming language

    derived from C and C++. It is firmly planted in the Cand C++ family tree of languages and has a heritage

    of Visual C++ that is expected to enable many of C

    and C++ developers to use their existing skills to

    rapidly develop sophisticated XML basedapplication. The key features are:

    Enhanced productivity, Complete access to the

    underlying platform and Low-level code control

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    35/57

    .NET Components

    Main Menu 35 of 57

    Visual Basic .NET

    VB .NET provides much new functionality: new

    object capabilities and new web capabilities head the

    list.

    Complete object-oriented capabilities

    Language capabilities like structured error handling

    and free threading

    Adjustment of Visual Basic to CLS (CommonLanguage Specification) and CTS (Common Type

    System)

    Better web interface capabilities

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    36/57

    .NET Components

    Main Menu 36 of 57

    Web Interfaces in VB.NET

    Visual Basic is the most used tool for component

    development. DHTML pages and WebClasses in VB

    6 never caught on. Developers stuck to ASP for

    actual user interface manipulation. Today, byintroducing the .NET Framework, Microsoft has

    opened a new option for web development.

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    37/57

    .NET Components

    Main Menu 37 of 57

    With VB.NET, web development is as easy as drag-and-drop. The .NET Framework includes Web

    Forms that provides such capability. Web forms

    work in Visual Basic the same way as with any

    .NET language. A design surface will have webcontrols that resemble the normal form controls.

    There is an HTML page containing positioning and

    formatting information for the page and a code

    module containing routines that can be attached to

    the page. Some of these routines could be the event

    routines that get fired by the web controls. Thus,

    Web Forms and Server Controls make them work.

    Web Interfaces in VB.NET

    NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    38/57

    .NET Components

    Main Menu 38 of 57

    Technology

    Visual Studio also supports some technology which

    are given below. With the help of Visual Studio

    .NET a developer can create a robust application,

    windows services or web services.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    39/57

    .NET Components

    Main Menu 39 of 57

    Win Forms

    Because of .NET Framework, it becomes easy to

    develop web-based applications, however not all

    applications will run on the web. So this is where

    Windows Forms comes in. Windows Form orWinForms is a forms package that .NET uses to

    build Windows based applications. WinForms are

    set of classes and incorporate .NET platforms

    technologies, such as object-oriented design,security, managed execution and support for

    building data-aware applications based on

    ADO.NET.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    40/57

    .NET Components

    Main Menu 40 of 57

    All the controls in the WinForms will have certain

    properties and events attached to them that a

    developer can work upon. There are certain

    enhancements made in the properties and eventsfrom previous Forms.

    Win Forms

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    41/57

    .NET Components

    Main Menu 41 of 57

    Web Forms

    Now days, applications that deal with the World

    Wide Web are more widely created. Therefore

    programmers have moved to Active Server Pages

    (ASP) technology as a means to develop webapplications. Web forms are a part of the ASP.NET

    technology. They allow the programmer to develop

    web pages that combine visual HTML forms with

    server side code.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    42/57

    .NET Components

    Main Menu 42 of 57

    Web Forms

    Visual Studio .NET takes full advantage of Web

    Forms, one of the key new technologies in the .NET

    Framework. With Web Forms, Visual Studio .NET

    addresses the difference between the techniquesused to build desktop applications and those used to

    create Web applications. With Visual Studio .NET

    and Web Forms, developers can rapidly develop

    cross-platform, cross-browser programmable Webapplications using the very same techniques

    previously utilized to build form-based desktop

    applications.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    43/57

    p

    Main Menu 43 of 57

    A standard Web Forms page consists of a Web Form

    "markup" file containing the visual, XML-based

    representation of the page (HTML, WML, XML,

    etc.), and a source file with event handling code. Thesource is compiled into executable code providing

    fast runtime performance. Both files reside and

    execute on the server where they generate a Web

    page that is sent to the client.

    Web Forms

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    44/57

    p

    Main Menu 44 of 57

    The page can be generated as pure HTML, which

    means it can be viewed on any platform, with any

    browser. Or it can target the special capabilities of a

    specific browser. It can even be targeted to mobiledevices that support WML and WAP, using the

    Adaptive UI Controls, all while using the same

    business logic on the server.

    Web Forms

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    45/57

    p

    Main Menu 45 of 57

    ADO.NET

    ADO.NET is designed with the goal of better

    serving the data access needs of web applications.

    ADO.NET is designed to be data-centric, non-

    database-centric, focused on handling disconnecteddata sets, and tightly integrated with XML. It

    enables better data sharing capabilities between

    components and tiers in an application.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    46/57

    p

    Main Menu 46 of 57

    ADO.NET

    The .NET Data Provider object group contains

    objects for accessing SQL Server and OLEDB data

    sources and includes Connection and Command

    objects that are similar to their ADO counterparts. A.NET data provider is used for connecting to a

    database, executing commands, and retrieving

    results. Those results are either processed directly, or

    placed in an ADO.NET DataSet in order to beexposed to the user.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    47/57

    p

    Main Menu 47 of 57

    Web Services

    Web Services are the component that runs on the

    server and typically include business logic.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    48/57

    p

    Main Menu 48 of 57

    Advent of Web Services

    Before discussing .NET further in detail, shall learn

    what Web Services are and then will see how .NET

    relates to web services.

    Historically, developers built applications byintegrating local system services. This model gave

    developers access to a rich set of development

    resources and precise control over how the

    application would behave.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    49/57

    p

    Main Menu 49 of 57

    A Web Service represents a black box functionalitythat can be reused without worrying about how the

    service is implemented. They provide well-defined

    interfaces that describe the services provided.

    Developers can assemble applications using a

    combination of remote services, local services and

    custom code.

    Advent of Web Services

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    50/57

    Main Menu 50 of 57

    For example, a company might assemble an online

    store using Microsofts Passport service to

    authenticate users, a third party personalization

    service to adapt web pages to each userspreferences, a credit card processing service,

    package tracking services from each shipping

    company, an in-house catalog service that connects

    to the companys internal inventory managementapplications, and a bit of custom code to make sure

    that their store stands out from the crowd.

    Advent of Web Services

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    51/57

    Main Menu 51 of 57

    .NET and Web Services .NET is founded on this principle of web services.

    Through .NET, Microsoft is providing the

    infrastructure to enable the evolution of web services

    through each of the pieces of .NET platform.

    It allows applications to use straightforward code to

    access and utilize web-based services. The web

    servers can thus easily expose their services to

    external applications.

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    52/57

    Main Menu 52 of 57

    The server that is providing the services or the clientapplications and web sites that are utilizing theseservices do not have to be necessarily written using.NET. It is just that .NET platform will make a loteasier to develop these applications.

    The entire .NET plan of Microsoft is based on XMLthat helps create a common format to send andtransfer data over a network. Microsoft wantseveryone from software developers to software usersto use XML technology for transferring data overthe web.

    .NET and Web Services

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    53/57

    Main Menu 53 of 57

    Summary

    Key points covered in this chapter are:

    Visual Studio.NET (VS.NET) is a powerful

    development tool and provides an IDE for various

    different languages. Visual Studio.NET does not only have designer for

    visual modules, but components also have a designer

    VS.NET the development process substantiallyeasier and more productive by providing a drag-and-

    drop rapid application development solution for

    developers

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    54/57

    Main Menu 54 of 57

    C# is a simple, modern, object oriented and type safe

    programming language derived from C and C++.

    ASP.NET's brings a language-independent way of

    creating components and dynamic web applicationsthat can produce output on any platform or device.

    ADO.NET works with data in a disconnected way

    under .NET Frameworks stateless distributed web

    model.

    ADO.NET is specifically designed to operate in 3-

    tier environment.

    Summary

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    55/57

    Main Menu 55 of 57

    Self Assessment

    Fill in the blanks:

    __________________ displays an organized list of projects

    Command Window has two modes_____________ and

    __________________

    The _____________ can show all current syntax errors in the

    current code

    The _____________ provides tools for working with XML

    and XSD files.

    ____________ supply the user interface for viewing the logs

    and a programming interface for examining the logs.

    Solution Explorer

    Command

    Immediate mode

    TaskList

    XMLDesigner

    EventLogs

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    56/57

    Main Menu 56 of 57

    State True or False: The standard VB form has been replaced by Web

    Form.

    The Command Mode is used to execute command

    directly in the Visual Studio .NET environment

    which are not supported in the menu option of the

    VS.NET.

    A wide variety of server resources that are availablefor use can be seen with help of Solution Explorer.

    Self Assessment

    True

    True

    True

    .NET Components

  • 8/9/2019 Chapter 2 - .NET Component

    57/57

    State True or False:

    Microsoft Message Queuing (MSMQ) makes it easy

    for developers to communicate with the application

    programs quickly. C# aims to combine the high productivity of Visual

    Basic and the raw power of C++.

    Self Assessment

    True

    True