fundamentos .net

Upload: retwet

Post on 05-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Fundamentos .NET

    1/36

    The Microsoft Application Platform

    The Need for .NET

    What Is The Microsoft Application Platform?

    The .NET Framework

    The Windows Server System

    Building Block Services

    Clients for the .NET Framework

    This lesson introduces the components that make up the Microsoftapplication platform, which is designed to simplify development.

  • 7/31/2019 Fundamentos .NET

    2/36

    The Need for .NET

    Microsoft .NET:

    Solves many problems with existingtechnology

    Provides applications that supportinteroperable XML Web services

    Provides applications that support smartclients

    .NET and the Microsoft application platform were designed to facilitate workingwith the Internet by integrating Internet standards and supporting Web

    services. The .NET Framework also makes it easier to access your data andwrite Web applications that run on a wide variety of browsers and devices. The

    .NET runtime supports simplified and reliable installation and upgrades for easeof use and increased reliability.

    Problems with existing technologies

    Many of todays Web applications have interactive user interfaces that are builtby using dynamic HTML (DHTML) and Microsoft ActiveX technology.

    Although most of these applications communicate effectively, many have someor all of the following problems:

    Each application is a distinct piece of code in alarge number of devices.

    Solutions are large groups of applications,devices, and services.

    Integration is too hard, too expensive, tooslow, and too rigid when accomplished.

    Interoperable Web services

    Interoperability is the key to the next generation of applications. Virtualorganizations need Web applications that can interact with other applications.

    The applications should expose a programmable interface that interacts withother services on the Web. For example, airlines, hotels, and rental car

  • 7/31/2019 Fundamentos .NET

    3/36

    companies can expose their services as Web services. A travel agent can use

    these services to find the best combination of prices and services forcustomers.

    Support for smart clients

    Technology has also advanced rapidly, resulting in lower costs for computerhardware and connectivity to the Internet. Because todays business world

    demands instant access to data, devices such as mobile phones, personaldigital assistants (PDAs), and laptop computers are now standard. Applications

    developed for .NET take advantage of recent advances in technology bysupporting smart clients and can run on multiple operating systems.

  • 7/31/2019 Fundamentos .NET

    4/36

    What Is the Microsoft ApplicationPlatform?

    Visual StudioVisual Studio

    .NET Framework.NET Framework.NET buildingblock services.NET buildingblock services

    Windows ServerSystem

    Windows ServerSystem

    Microsoft OfficeSystem

    Microsoft OfficeSystem

    Internet

    The Microsoft application platform consists of the following core technologies:

    Microsoft Visual Studio

    .NET Framework

    Windows Server System

    Microsoft Office System

    Building block servicesMicrosoft Visual Studio provides a high-level development environment forbuilding applications on the .NET Framework. It provides key enabling

    technologies to simplify the creation, deployment, and ongoing evolution ofsecure, scalable, highly available Web applications and Web services. Theseapplications can be deployed on several platforms, including the WindowsServer System, and can use available .NET building block services as well as

    functionality from the Microsoft Office System.

  • 7/31/2019 Fundamentos .NET

    5/36

    The .NET Framework

    .NET Framework.NET Framework

    Windows UIWindows UI ASP.NETASP.NET

    ADO.NET: Data & XMLADO.NET: Data & XML

    .NET Framework class library.NET Framework class library

    Common Language RuntimeCommon Language Runtime

    The .NET Framework is a language-neutral component library and executionenvironment. It enables you to build integrated, service-oriented applications

    that meet the needs of todays Internet businesses by gathering informationfrom and interacting with a wide variety of sources, regardless of the platforms

    or languages in use.

    The .NET Framework consists of the following components:

    Common Language Runtime

    .NET Framework class library

    Microsoft ADO.NET (data and XML)

    Microsoft ASP.NET

    Common Language Runtime

    The Common Language Runtime (CLR) simplifies application development,provides a robust and secure execution environment, supports multiple

    languages, and simplifies application deployment and management. Theenvironment is called a managed environment in which common services, such

    as garbage collection and security, are automatically provided.

    NET Framework class library

    The .NET Framework provides a unified, object-oriented, hierarchical,

    extensible set of class libraries for developers. Previously, C++ developersused the Microsoft Foundation Classes, Visual Basic developers used classes

    provided by the Visual Basic runtime, and other languages used their own classlibraries and frameworks. In essence, the .NET Framework unifies the

  • 7/31/2019 Fundamentos .NET

    6/36

    disparate frameworks that Microsoft previously provided. As a result,

    developers no longer need to understand multiple frameworks.

    In addition, by creating a common set of application programming interfaces(APIs) across all programming languages, the .NET Framework enablescrosslanguage inheritance, error handling, and debugging. Therefore, all

    programming languages, from JScript to Microsoft Visual C++, becomeequals, and developers are free to choose the language that they want to use.

    ADO.NET: Data and XML

    ADO.NET is the next generation of ActiveX Data Object (ADO) technology.ADO.NET is tightly integrated with XML, enabling developers to transfer

    datasets (in-memory data caches) between the various components of anenterprise solution.

    ASP.NET

    ASP.NET builds on the programming classes of the .NET Framework, providinga Web application model in the form of a set of controls and infrastructure that

    makes it easy to build Web applications. Developers have access to a set ofASP.NET Web controls that encapsulate common Hypertext

    Markup Language (HTML) user interface features such as text boxes and drop-down menus. These controls run on the Web server and project their user

    interface as HTML to a browser.

    On the server, the controls expose an object-oriented programming model thatbrings the power of object-oriented programming to the Web developer.ASP.NET also provides infrastructure services, such as session state

    management and process recycling, which further reduces the amount of codethat a developer must write and increases application reliability. ASP.NET also

    uses these same concepts to enable developers to deliver software as aservice.

    By using Web services, developers can simply write their business logic and letthe ASP.NET infrastructure deliver the service through SOAP.

  • 7/31/2019 Fundamentos .NET

    7/36

    The Windows Server System

    The Windows Server System is an integrated serverinfrastructure that includes:

    Windows Server 2003BizTalk ServerExchange ServerSharePoint Portal ServerOperations ManagerProject ServerSQL ServerSystems Management Server

    The Windows Server System is the comprehensive Microsoft family of serverapplications for building, deploying, and managing scalable, integrated,

    Webbased solutions. Designed with mission-critical performance in mind, theWindows Server System provides scalability, reliability, and manageability for

    the global, Web-enabled enterprise. These products are built specifically forinteroperability by using open Web standards such as XML. By using XML

    standards, Microsoft is providing a new development platform infrastructurethat will help developers quickly create and deploy distributed applications on

    Internet time.

    Windows Server System

    The following are descriptions of the various members of the Windows Server

    System:

    Microsoft Windows Server 2003: This is themost secure and reliable server platformMicrosoft has ever released. As the foundation

    for the Windows Server System, the serverplatform provides a unifying layer of common

    services across the IT, application, andinformation worker infrastructures. Windows

    Server 2003 builds on the strengths ofMicrosoft

    Windows 2000 technology, integratingstandards-based directory, Web application,

    communication, file, and print services withhigh reliability, efficient management, and

  • 7/31/2019 Fundamentos .NET

    8/36

    support for the latest advances in networking

    hardware.

    Microsoft Application Center: This enables

    Web applications built on Windows Server2003 to achieve mission-critical availability

    (99.999 percent uptime) through softwarescaling while reducing operational complexityand costs.

    Microsoft BizTalk Server: This is a

    standards-based platform for developing andmanaging application integration within andbetween organizations by using XML as thecommon document format.

    Microsoft Commerce Server: This is thecomprehensive system for quickly buildingscalable, personalized business-to-consumer(B2C) and businessto- business (B2B) e-

    commerce solutions on Windows 2003.

    Microsoft Content Management Server: Thisdramatically reduces the time required to buildand deploy content-driven Web sites that

    deliver high scalability, reliability, andperformance. Content Management Server

    empowers content providers to manage theirown content and provides site users with a

    targeted and personalized experience tailoredto their individual profiles and browsingdevices.

    Microsoft Exchange Server: This completemessaging and collaboration application offers

    unmatched interoperability, ease of use, andlow-cost administration to organizations of allsizes.

    Microsoft Host Integration Server: Thiscomprehensive integration platform provides

    the best way to quickly embrace Internet,intranet, and client/server technologies while

    maximizing investments in existing legacysystems.

    Microsoft Internet Security and AccelerationServer: This provides you with secure and

    easily managed Internet connectivity andexpedites delivery of Web content through a

    scalable, reliable Web cache.

  • 7/31/2019 Fundamentos .NET

    9/36

    Microsoft Operations Manager: This delivers

    enterprise-class operations management byproviding comprehensive event management,

    proactive monitoring and alerting, reporting,and trend analysis. It helps reduce the day-to-day support costs associated with runningapplications and services in a Windows-based

    IT environment.

    Microsoft Project Server: This provides anextensible technology infrastructure tosecurely develop and deploy best practices for

    project management across your organization.

    Microsoft SharePoint This is the flexibleportal offering that enables informationworkers to easily and quickly find, share, and

    publish information. Together, Office

    SharePoint Portal Server and WindowsSharePoint Services give users the ability toorganize information, readily access that

    information, manage documents, and enableefficient collaboration, all in a familiar,browser-based and Microsoft Office integratedenvironment.

    Microsoft SQL Server: This brings improveddecision-making abilities to all levels of yourenterprise with scalable business solutions,powerful data warehousing, and integration

    with Microsoft Office.

    Microsoft Systems Management Server: Thisdelivers cost-effective, scalable change andconfiguration management for desktops and

    servers based on Windows and helpsadministrators to distribute security updates

    for all Microsoft products throughout theenterprise. Built on industrystandard

    management protocols, Systems ManagementServer is compatible with complementarymanagement tools from Microsoft and other

    companies.

  • 7/31/2019 Fundamentos .NET

    10/36

    Building Block Services

    Building block services:

    Allow the user to control the data

    Use Microsoft Passport Network

    The building block services are a set of Web services that move control of userdata from applications to users. These services enable personalization andconsistency across applications, services, and devices. Microsoft has developed

    private and secure services built around identity, notification, and storage thatcan act as building blocks for other Web services and .NET experiences.

    Microsoft Passport is the.NET initiative that makes it easy to integrate variousapplications.

    Microsoft Passport

    Passport is a core component of the .NET initiative that allows businesses todevelop and offer distributed Web services across a wide range of applications,devices, and complementary services, all based on a common Internetexperience.

    The Microsoft Passport single sign-in (SSI) service helps your business todeliver a fast, convenient way for consumers to sign in and make transactions

    securely on your site, by allowing them to use one sign-in name and password

    at all participating Web sites. In addition, because Passport sign-in names areassigned to individuals and not to computers, members can access Passportsites at any time from a wide range of devices.

    Implementing Passport on your site enables you to do the following:

    Increase traffic by simplifying the sign-in andregistration process.

  • 7/31/2019 Fundamentos .NET

    11/36

    Improve customer retention by delivering

    personalized content based on core Passportprofile data.

    Increase your sales by simplifying thepurchase process.

    Offer easier, more secure sign-in andpurchasing to millions of Passport members.

  • 7/31/2019 Fundamentos .NET

    12/36

    Clients for the .NET Framework

    The .NET Framework supports the followingsmart devices:

    Laptop computers

    Workstations

    Handheld computers

    PDAs

    Smart mobile phones

    Game consoles

    Tablet PCs

    To support the .NET Framework, Microsoft is building device software that willenable consumers to use a family of complementary devices instead of only asingle device or client. Microsoft is building software for everything from

    telephones and PDAs to other sets of devices and clients, such as laptopcomputers, workstations, handheld computers, smart mobile phones, game

    consoles (Microsoft Xbox), and the Tablet PC. Microsoft is currently working

    on the following software products for these devices: Embedded Windows XP,Windows CE 4.0, the .NET Framework, and the .NET Compact Framework.

    Smart devices

    All of these devices are known as smart devices because they remember who the

    user is and use the Web rather than the server as a platform for computing.

    Smart devices enable you to access, analyze, and act on data anywhere,

    anytime. They use the network intelligently and are responsive to bandwidthconstraints, provide support for both online and offline use of applications, and

    recognize which services are available.

    Smart devices are programmable and customizable, with automatic updatesand zero administration.

    Smart devices present and gather information in the most appropriate form for

    that device, such as converting text to speech on a mobile phone orrecognizing handwriting on a Tablet PC. Smart devices can consume Web

    services and discover which services are available because they use XML,SOAP, and Universal Description, Discovery, and Integration (UDDI).

  • 7/31/2019 Fundamentos .NET

    13/36

    Growth of smart devices will increase even more during the next few years as

    these devices become integrated with the ultimate smart Internet device, thePC.

  • 7/31/2019 Fundamentos .NET

    14/36

    Inside the .NET FrameworkCommon Language Runtime

    The .NET Framework Class Library

    ADO.NET Namespaces

    ASP.NET Namespaces

    The .NET Framework consists of the following components:

    Common Language Runtime (CLR)

    .NET Framework class library

    ADO.NET namespaces

    ASP.NET namespaces

  • 7/31/2019 Fundamentos .NET

    15/36

    Common Language Runtime

    .NET Framework Class Library Support

    .NET Framework Class Library Support

    COMMarshalerCOMMarshalerThread SupportThread Support

    Class LoaderClass Loader

    Code ManagerCode ManagerMSIL to Native

    CompilersMSIL to Native

    CompilersGarbageCollectorGarbageCollector

    Debug EngineDebug EngineSecurity EngineSecurity Engine

    Exception ManagerException ManagerType CheckerType Checker

    Runtimes are not new to programming. Many other programming languageshave used runtimes, including Visual Basic (VBRUN through version 4.0 and

    then MSVBVM through version 6.0), Visual C++ (MSVCRT), Microsoft VisualFoxPro, and JScript, in addition to third-party languages such as SmallTalk,

    Perl, and Java.

    The critical role of the .NET Framework, and what really sets it apart from

    other runtimes, is that it provides a unified environment across all

    programming languages. This environment is also referred to as a managedenvironment.

    CLR simplifies the development process

    Despite its name, the CLR has a role not only at run time, but also during a

    components development. While the component is running, the CLR isresponsible for managing memory allocation, starting up and terminating

    threads and processes, enforcing security policy, and satisfying anydependencies that the component has on other components.

    During development, the runtimes role changes slightly. Because it automates

    much functionality (such as memory management), the CLR makes thedevelopers work easier. In particular, the CLR ensures code correctness andtype safety. The CLR also dramatically reduces the amount of code a developer

    must write to transform business logic into a reusable component.

    The following are some of the programming features that were formerly

    required by operating systems but are now rendered unnecessary by the CLR:

    System registration is not needed because

    applications are completely selfdescribing.

  • 7/31/2019 Fundamentos .NET

    16/36

    Globally unique identifiers (GUIDs) are not

    needed because classes are organized by usinga hierarchical naming scheme with human-

    readable names.

    Interface Definition Language (IDL) files are

    no longer required because the system andlanguages use the same representations.

    HRESULTs are no longer used because theCLR uses structured exception handling.

    IUnknown is no longer required because itsfunctionality is provided by the root

    System.Object.

    Adding and releasing object references is no

    longer necessary because the CLR knowswhich objects are being used and can clean up

    unused objects whenever necessary.

    The Component Object Model (COM)

    CoCreateInstance method becomes an additional

    operator.

  • 7/31/2019 Fundamentos .NET

    17/36

    The .NET Framework ClassLibrary

    SystemSystem

    RuntimeRuntime

    CollectionsCollections IOIO SecuritySecurity

    ConfigurationConfiguration NetNet ServiceProcessServiceProcess InteropServicesInteropServices

    DiagnosticsDiagnostics ReflectionReflection TextText RemotingRemoting

    GlobalizationGlobalization ResourcesResources ThreadingThreading SerializationSerialization

    The .NET Framework class library is a collection of reusable classes, or types,that tightly integrate with the CLR. The library is made up of severalnamespaces. As an example, examine the System namespace.

    System namespace

    The System.IO namespace is found below the System namespace and contains

    input/output (I/O) services. The System.Collections namespace provides sorted

    lists, hash tables, and other ways to group data. The System.Net namespace

    provides Transmission Control Protocol/Internet Protocol (TCP/IP) and sockets

    support.

    The design goals of the .NET Framework class library were to:

    Enable factoring and extensibility.

    Implement Web standards and practices as

    the foundation.

    Unify application models.

    Increase developer productivity by supplying

    a single hierarchical and intuitive programmingmodel.

    Enable cross-language inheritance anddebugging.

    Make it easy to add or modify .NET

    Framework features.

  • 7/31/2019 Fundamentos .NET

    18/36

    Allow creation of secure applications.

    Functionality

    The .NET Framework class library provides a vast amount of functionality,including the following:

    Managing collections of objects

    Providing database access

    Drawing to the screen

    Providing security and encryption

  • 7/31/2019 Fundamentos .NET

    19/36

    ADO.NET Namespaces

    ADO.NET implements the followingnamespaces:

    System.Data namespace

    System.Xml namespace

    The .NET Framework provides a new set of ADO.NET classes to handle data.

    ADO.NET provides improved support for the disconnected programming model.It also provides rich XML support.

    System.Data namespace

    The System.Data namespace consists of classes that constitute the ADO.NET

    object model. At a high level, the ADO.NET object model is divided into twolayers: the connected layer and the disconnected layer.

    The System.Data namespace includes the DataSet class, which represents multiple

    tables and their relations. These datasets are completely self-contained datastructures that can be populated from a variety of data sources. One data

    source could be XML, another could be OLE Database (OLEDB), another couldbe Oracle, and a fourth data source could be SQL Server.

    System.Xml namespace

    The System.Xml namespace provides support for XML. It includes an XML parser

    and a writer, both of which are compliant with World Wide Web Consortium(W3C) standards. The System.Xml.Xsl namespace provides support for Extensible

    Stylesheet Language Transformations (XSLT). Implementation of the XML Path

    Language (XPath) allows data graph navigation in XML. TheSystem.Xml.Serialization namespace provides the entire core infrastructure for

    Web services, including features such as moving back and forth from objects toan XML representation, and support for SOAP.

  • 7/31/2019 Fundamentos .NET

    20/36

    ASP.NET NamespacesSystem.WebSystem.Web

    SessionStateSessionStateConfigurationConfiguration

    SecuritySecurityCachingCaching

    ServicesServices UIUI

    HtmlControlsHtmlControls

    WebControlsWebControls

    DescriptionDescription

    DiscoveryDiscovery

    ProtocolsProtocols

    The Internet is quickly evolving, from Web sites that deliver simple userinterface (UI) pages to browsers, to the emerging generation of programmable

    Web sites that directly link organizations, applications, services, and devices.

    ASP.NET is a programming framework built on the CLR that you can use on a

    server to build powerful Web applications. ASP.NET Web Forms provide aneasy way to build dynamic Web UIs. Web services, created by using ASP.NET,

    provide the building blocks for constructing distributed Web-based applications.

    Web services are based on open Internet standards, such as HTTP and XML.

    The CLR provides built-in support for creating and exposing Web services byusing a programming abstraction that is consistent and familiar to both ASP

    and Visual Basic developers. The resulting model is both scalable andextensible. This model is based on open Internet standards (HTTP, XML, SOAP,

    SDL) so that it can be accessed and interpreted by any client or Internet-enabled device.

    Some of the more common ASP.NET namespaces are described in the followingsection.

    System.WebThe System.Web namespace implements lower-level services such as caching,

    security, configuration, and other services that are shared between Web

    services and Web UI.

  • 7/31/2019 Fundamentos .NET

    21/36

    System.Web.Services

    The System.Web.Services namespace includes classes that handle XML Web

    services such as protocols and discovery.

    System.Web.UI

    The System.Web.UI namespace provides two classes of controls: HtmlControls and

    WebControls. The HtmlControls give you direct mapping of HTML tags, such as

    input. WebControls enable you to structure controls with templates (for

    example, a grid control).

  • 7/31/2019 Fundamentos .NET

    22/36

    *****************************

    *

    Introduction to .NET Languages

    What Are the Benefits of LanguageNeutrality?

    Selecting a Language

    Reducing Programming Errors

    The CLR Execution Model

    Demonstration: Using Multiple Languages

    ****************************illegal for non-trainer use******************************

    In Visual Studio, a single-user interface supports multiple languages. In this

    lesson, you will learn about the benefits of the language-neutrality features ofthe .NET Framework. You will also look at criteria for selecting the languagethat is most suitable for creating .NET-based applications.

  • 7/31/2019 Fundamentos .NET

    23/36

    What Are the Benefits of

    Language Neutrality?The benefits of language neutrality include:

    Code sharing and reusability

    Same API access for all languages

    Implementation inheritance

    Exception handling across languages

    The language neutrality of the .NET Framework provides many benefits todevelopers. Some of the most powerful benefits are described in this topic.

    Code sharing and reusability

    In the past, developers often had problems sharing code because somedevelopers on a team would work in C++ while others would work in adifferent language such as Visual Basic. Depending on how the C++ code was

    written, it might or might not have been accessible by Visual Basic developers.The .NET Framework eliminates this problem because any .NET-compatible

    language can call any .NET class and can even extend that class for its ownpurposes. Reusing code now becomes automatic.

    Same API access for all languages

    An object model API is usually language independent and defines a set ofobjects, properties, and interfaces. A database API defines how to code an

    application to connect to and pass commands to a database. The .NETFramework makes the same set of APIs available to programmers, regardless

    of the coding language they use.

    Implementation inheritance

  • 7/31/2019 Fundamentos .NET

    24/36

    Inheritance means that if you make a change to a class, that change is reflected

    in all subclasses. This automatic update saves you time and effort. A class orcomponent written in one language can be extended in another language.

    Exception handling across languages

    Traditionally, a languages error handling model relied on either the languagesunique way of detecting errors and locating handlers for them, or on the error-

    handling mechanism provided by the operating system. In the .NETFramework, the CLR facilitates the design of error-tolerant software by

    providing a platform for uniform error handling. The CLR handles exceptionsfor all .NET-compatible languages. It does not matter which language was usedto generate the exception or which language will be called upon to handle theexception.

  • 7/31/2019 Fundamentos .NET

    25/36

  • 7/31/2019 Fundamentos .NET

    26/36

    upgraded to Visual Basic 6.0 before migrating

    to Visual Basic 2005.

    If you are a J++, JScript, or Java developer,

    transitioning to Visual J# 2005 or C# would beeasiest for you. Existing JScript applications

    can be migrated to JScript 2 Existing Java orVisual J++ applications can be migrated to J#.For new applications, C# might be a betterchoice because some project types are not

    available for J#, for example, Smart DeviceProjects.

    If you are a C or C++ developer, transitioningto C# or Managed C++ would be easiest for

    you. For new or .NET applications, C# mightbe a better choice because some project types

    are not available for Managed C++, for

    example, Smart Device Projects. Forspecialized applications, such as devicedrivers, C++ is the best choice.

    New Features in Visual Basic and C#

    Visual Basic and C# have many significant improvements in.NET Framework2.0, including generic types and partial classes. Visual Basic now includes the

    My namespace for speedy development, while the newest version of C#

    includes iterators, anonymous methods, and support for refactoring.

    Visual C++ .NET

    Managed C++ can access the same Windows Forms engine that C# can. Thisfeature includes full support of the Toolbox, Properties window, and ServerExplorer, which allows you to drag or perform a cut-and-paste on controls andcomponents directly in your Windows Forms application.

    Existing C++ code compiles for .NET without the need to rewrite it in a newlanguage. Visual C++ 2005 supports intermixed managed and unmanaged

    code and data to provide maximum performance and control.

    Visual C++ .NET offers developers extremely powerful features for targeting

    the .NET-connected technologies. Existing C++ code is easily recompiled for.NET without modification, and developers are able to immediately begin usingthe powerful .NET Framework classes with familiar C++ syntax. New andexisting components and applications written in C++ are easily exposed to

    .NET, enabling a multitude of cross-language possibilities and solutions.

    Powerful interop features specific to Visual C++ ensure that C++ applications

    can continue to leverage their roots on the Windows platform as they aremoved forward to the .NET CLR.

  • 7/31/2019 Fundamentos .NET

    27/36

    Visual J# .NET

    Visual J# supports most of the features of Visual J++ 6.0, including Microsoftextensions. It also has the ability to convert some Java binaries to run in theCLR. The Visual J# Binary Converter Tool transforms Java bytecode into MSIL

    code. It works for most Java Development Kit (JDK) 1.1.4level libraries and

    applications, but not all. The preferred method of porting is to recompile theJava-language source as Visual J#.

    Visual J# is designed to provide class library support functionality equivalent to

    most of the JDK level 1.1.4 packages that were included in Visual J++ 6.0.Visual J# also supports the Windows Foundation Classes (WFC) libraries andthe following com.ms. packages: com.ms.lang, com.ms.dll, com.ms.com,com.ms.win32, com.ms.util, and com.ms.jdbc.odbc.

  • 7/31/2019 Fundamentos .NET

    28/36

    Reducing Programming ErrorsFeatures that reduce programming errors include:

    Garbage collection

    Constructors and destructors

    Variable initialization

    Syntax checking

    Type checking

    Type conversion

    NamespacesStructured exception handling

    The .NET Framework maximizes programmer efficiency by providing newfunctionality that reduces programming errors.

    Garbage collection

    The .NET Framework eliminates concern over memory management because

    garbage collection takes care of this for you. The CLR checks at regularintervals for objects that are no longer used and puts them in the recycle bin.

    The CLR does not use reference counting to govern object lifetime. Instead, abackground garbage collection task traces object references and identifies

    objects that can no longer be reached by running code.

    With garbage collection, you no longer have to worry about circular references.

    If objects in a group contain references to each other, but all referencesoutside the group have been set to null or Nothing, garbage collection

    automatically reclaims the memory. Therefore, you do not need to beconcerned about memory leaks.

    An additional advantage of traced garbage collection is that allocation of newobjects in memory is extremely fast. Performance is further improved by the

    elimination of the COM AddRefand Release mechanisms, and objects require less

    memory.

  • 7/31/2019 Fundamentos .NET

    29/36

    Constructors and destructors

    Constructors are procedures that control initialization of new instances of aclass. Conversely, destructors are methods that you use to free systemresources when a class leaves scope or is set to null or Nothing. When used

    together, constructors and destructors support the creation of powerful and

    predictable class libraries.

    Variable initialization

    Variables can now be initialized during declaration. This results in simplified,compact code.

    Syntax checking

    Visual Studio, the shared development environment, provides excellentsupport for writing programs. It uses IntelliSense extensively to help

    programmers write valid code. IntelliSense displays syntax tips for statements

    as you type them and provides code completion on keywords.

    Type checking

    Type checking, performed at compile time, catches statements that use animproper data type before they can cause subtle execution errors at run time.

    Type conversion

    The process of changing a value from one type to another type is called type

    conversion. Type conversions can be either widening or narrowing. Widening

    conversions never fail and can be accomplished with no loss of information.

    Narrowing conversions might fail and always involve some kind of informationloss.

    Namespaces

    Namespaces prevent naming conflicts by organizing classes, interfaces, and

    methods into hierarchies.

    Structured exception handling

    Structured exception handling helps you create and maintain programs with

    robust, comprehensive error handlers. Structured exception handling is codedesigned to detect and respond to errors during execution by combining a

    control structure (similar to Select Case or switch) with exceptions, protected

    blocks of code, and filters.

    Using the try...catch...finally statement, you can protect blocks of code that have

    the potential to raise errors. You can nest exception handlers, and thevariables declared in each block will have local scope.

  • 7/31/2019 Fundamentos .NET

    30/36

    The CLR Execution Model

    Common LanguageRuntimeCommon LanguageRuntime

    Sourcecode

    Managedcode

    Visual BasicVisual Basic C#C# C++C++

    JIT compilerJIT compiler

    Native codeNative code

    Operating systemservicesOperating systemservices

    UnmanagedcomponentUnmanagedcomponentCompilerCompiler CompilerCompiler CompilerCompiler

    Assembly ILcode

    Assembly ILcode

    Assembly ILcode

    Assembly ILcode

    Assembly ILcode

    Assembly ILcode

    The base unit of a .NET-based application is called an assembly. An assembly is

    the unit of versioning and deployment. Typically, you compile your source codeinto an .exe file or a DLL. (However, you can also create modules, which can

    later be linked to an .exe file or a DLL.) These are the simplest forms ofassemblies.

    Compilers generate assemblies containing MSIL code. However, apart from the

    MSIL code, the compiler inserts metadata into the assembly. Metadata is acollection of information that describes all of the types, classes, methods,fields, and events contained within the assembly. This is similar to the idea ofa type library. However, unlike a COM server that may or may not have a type

    library resource embedded in it, an assembly and its metadata are inseparable.This means that the assembly is self-describing.

    Single-file and multifile assemblies

    In many cases, an assembly can be thought of as a single .exe file or DLL. In

    some situations, a single assembly makes deployment much simpler becauseall required components are bundled together. However, a number of

    assemblies (for example, DLLs) can be linked together in one assembly knownas a multifile assembly.

    To achieve this, you use the assembly linker tool, AL.exe. In some situations,for example, in Web-based applications, the fact that assemblies are contained

    within separate files can be a great advantage because only those modulesthat are required can be downloaded.

  • 7/31/2019 Fundamentos .NET

    31/36

    The CLR execution model

    Before the MSIL code can be executed, it must be converted into native binaryinstructions. The compilation is typically carried out by a just-in-time (JIT)compiler.

    Source code written in C#, J#, Managed C++, Visual Basic or anotherlanguage that targets the CLR is first transformed into MSIL code by the

    appropriate language compiler. Before execution, this MSIL code is compiledinto native code by a JIT compiler for whatever processor the code will run on.

    The JIT compiler does not compile the entire code at one time. The default isto JITcompile each method when it is first called, but it is also possible to pre-JIT the IL code by using the Native Image Generator (NGEN.exe). With thisoption, all methods are compiled before the application is loaded, so you can

    avoid the overhead of JIT compilation on each initial method call.

    Note that all languages targeting the CLR should exhibit roughly the same

    performance. Although some compilers might produce better MSIL code than

    others, large variations in execution speed are unlikely.

  • 7/31/2019 Fundamentos .NET

    32/36

    *****************************illegal for non-trainer use******************************

    Microsoft Developer Tools RoadmapVisual Studio 2005

    Visual Studio Orcas

    Visual Studio2005

    SQL Server integration

    Improved productivityand community support

    Extended support forWeb services

    Office programmability

    Visual StudioOrcas

    Windows integrationwith WinFX

    New UI tools

    and designersLanguage enhancements

    Enhanced officeprogrammability

    Visual Studio 2005 includes tighter integration with Microsoft SQL Server 2005

    as well as productivity improvements and extended support for Web services.Future versions will include support for the next version of the Windows

    operating system, new UI tools, and additional language enhancements.

  • 7/31/2019 Fundamentos .NET

    33/36

    Visual Studio 2005.NET Framework 2.0

    Generics

    Enhanced ASP.NET

    Improved ADO.NET

    Edit and Continue

    Enhanced IntelliSense and Auto-correct

    Microsoft Office integration

    Improved language features

    Visual Studio 2005 includes a number of significant enhancements over VisualStudio .NET 2003, including support for.NET Framework 2.0, support for editand continue debugging, improved IntelliSense and Auto-correct, and tighter

    integration with Microsoft Office, as well as a number of language-specificimprovements.

    .NET Framework version 2.0

    Visual Studio 2005 now targets version 2.0 of the .NET Framework, whichincludes new framework classes, members, and documentation and support for

    64-bit platforms. Significant improvements include:

    Generics, which enable developers to build

    flexible, reusable code. You can build classes,methods, structures, and interfaces by

    specifying generic type parameters. The .NETFramework uses generics to enable stronglytyped collections in the System.Collections.Generic

    namespace.

    An enhanced ADO.NET, which includessupport for features such as userdefined types,

    bulk copy operations, asynchronousprocessing, and a provider-independent API.

    An improved ASP.NET, which includes manynew controls, caching improvements, and tools

  • 7/31/2019 Fundamentos .NET

    34/36

    for quickly building robust Web sites such as

    Master Pages, Themes, and Skins.

    Edit and continue

    In previous releases of Visual Studio, programmers in the process of

    debugging an application had to stop debugging to make any changes to theircode. In Visual Studio 2005, programmers can make code changes and resume

    debugging immediately without having to restart the application.

    Microsoft Office integration

    With Visual Studio 2005 comes a new version of Visual Studio, known as Visual

    Studio Tools for Office (or VSTO), which enables developers to create powerful,customized solutions for Office applications.

    C# improvements

    C# improvements include:

    Refactoring

    Anonymous types

    Visual Basic improvements

    Visual Basic improvements include:

    The My namespace

    New operators

  • 7/31/2019 Fundamentos .NET

    35/36

    Visual Studio Orcas

    Windows integration (WinFX)

    Improved presentation

    Service-oriented messaging

    Work-flow based task automation

    Query expressions (LINQ

    The next version of Microsoft Visual Studio, codename Orcas, will includemodifications of Windows Vista, support for a set of managed APIs knowncollectively as WinFX, and new language enhancements.

    WinFX

    WinFX is the name of the managed successor to the Microsoft Win32 API andwill be introduced with Windows Vista. (The WinFX runtime components will

    also be installable in Windows XP and Windows Server 2003.) WinFX has threeprincipal components:

    Windows Presentation Foundation (WPF) addsvector graphics to Windows Forms. With WPF,

    programmers will be able to build formsdeclaratively by using a new XML-based

    language, the Extensible Application MarkupLanguage (XAML).

    Windows Communication Foundation (WCF)

    offers a unified programming model forcommunications between applications either ona single machine or across multiple machines.WCF places various communicationtechnologies under a unified API, includiong

    Web services, remoting, message queuing, anddistributed transactions, for building robust

    and extensible Service-Oriented Architectures.

  • 7/31/2019 Fundamentos .NET

    36/36

    Windows Workflow Foundation (WWF) is a

    new technology for running and managingworkflows. Workflows can be defined

    declaratively using XAML or programmaticallyusing any .NET language.

    Query expressions

    Language Integrated Query (LINQ) expressions, will be built into the language(both Visual Basic and C#) for querying relational data as well as XML data

    without embedding SQL into the code.