.NET Framework .NET Training Program Ashutosh Pandey Student Incharge - Software Incubator Computer Science and Engineering Ajay Kumar Garg Engineering College, Ghaziabad Email: meatashu@gmail.com, Phone: 9990687407 1 Software Incubator .NET Training Program Wednesday, March 23, 2016 Overview What is .NET? - Technology .NET Framework - collection Visual Studio - IDE C# and VB – common languages 2 tier architecture 3 tier architecture N tier architecture Wednesday, March 23, 2016 Software Incubator 2 Why .Net? Why C……..brainstorming Why Java …..Brainstorming Now why .net ??? Fast application development No new concept Fastest emerging technology in IT Market Job Oriented Has a wide range of applications Object Oriented(close to real world) Wednesday, March 23, 2016 Software Incubator 3 What is Microsoft .NET? .NET is a Framework that provides a common platform for many languages. 44 languages in the beginning…..so can u guess what is the no now ??? The .NET Framework is an environment for building, deploying, and running Web applications and Web Services Wednesday, March 23, 2016 Software Incubator 4 Advantages of .NET Direct Support for Security Consistent Programming Model Windows Presentation Format Support with XAML Intelli-sense Debugging Greatly simplifies language interoperability. Supports strongly typed languages Calling from and to any other .NET language becomes simple It uses industry-standard protocols such as TCP/IP, XML, SOAP and HTTP Easy Application Deployment and Maintenance Simplified Development Efforts Wednesday, March 23, 2016 Software Incubator 5 .NET Framework Wednesday, March 23, 2016 Software Incubator 6 .NET Framework .NET Framework consists of 3 main parts: Common Language Runtime MSIL Framework Classes/Libraries Wednesday, March 23, 2016 Software Incubator 7 The .NET Framework VB C++ C# JScript … Common Language Specification ADO.NET: Data and XML Base Class Library Visual Studio.NET Windows Windows Forms Forms ASP.NET: Web Services and Web Forms Common Language Runtime Wednesday, March 23, 2016 Software Incubator 8 Common Language Runtime (CLR) A common runtime for all .NET languages Common type system Common metadata Intermediate Language (IL) to native code compilers Memory allocation and garbage collection Code execution and security Over 44 languages supported today C#, VB, Jscript, Visual C++ from Microsoft Perl, Python, Smalltalk, Cobol, Haskell, Mercury, Eiffel, Oberon, Oz, Pascal, APL, CAML, Scheme, etc. Wednesday, March 23, 2016 Software Incubator 9 Common Language Runtime (CLR) CLR works like a virtual machine in executing all languages. All .NET languages must obey the rules and standards imposed by CLR. Examples: Object declaration, creation and use Data types,language libraries Error and exception handling Interactive Development Environment (IDE) Wednesday, March 23, 2016 Software Incubator 10 Intermediate Language (IL) .NET languages are not compiled to machine code. They are compiled to an Intermediate Language (IL). CLR accepts the IL code and recompiles it to machine code. The recompilation is just-in-time (JIT) meaning it is done as soon as a function or subroutine is called. The JIT code stays in memory for subsequent calls. In cases where there is not enough memory it is discarded thus making JIT process interpretive. Wednesday, March 23, 2016 Software Incubator 11 Compilation in .NET Code in VB.NET Code in C# Code in another .NET Language VB.NET compiler C# compiler Appropriate Compiler IL(Intermediate Language) code CLR just-in-time execution Wednesday, March 23, 2016 Software Incubator 12 Common Language Runtime Multiple Language Support CTS is a rich type system built into the CLR Implements various types (int, double, etc) And operations on those types CLS is a set of specifications that language and library designers need to follow This will ensure interoperability between languages Wednesday, March 23, 2016 Software Incubator 13 Common Language Runtime (CLR) Enables cross-language interoperability Language/Hardware/OS Independent Common Language Specification describes interoperability requirements Compact framework for small devices Industrial strength Garbage collector Designed for multi-processor servers Wednesday, March 23, 2016 Software Incubator 14 CLR: Execution Model Source code Managed code VB C# C++ Compiler Compiler Compiler Assembly IL Code Assembly IL Code Assembly IL Code Unmanaged Component Common Language Runtime JIT Compiler Native Code Operating System Services Wednesday, March 23, 2016 Software Incubator 15 .NET Framework Libraries Single consistent set of object oriented class libraries to enable building distributed web applications (Unified Classes) Built using classes arranged across logical hierarchical namespaces For example: System.Data.SQL Work with all CLR languages No more “VBRun” or “MFC” divide Wednesday, March 23, 2016 Software Incubator 16 .NET Framework Libraries Unified Classes Web Classes (ASP.NET) Controls, Caching, Security, Session, Configuration etc Data (ADO.NET) Windows Forms ADO, SQL,Types etc Design, Cmpnt Model etc XML Classes Drawing Classes XSLT, Path, Serialization etc Drawing, Imaging, Text, etc System Classes Collections, Diagnostics, Globalization, IO, Security, Threading Serialization, Reflection, Messaging etc Wednesday, March 23, 2016 Software Incubator 17 ASP.NET ASP.NET is a new programming framework designed to make web apps easier to: Build, Deploy, Run Radical advancement of today’s ASP Broader programming language support Easier page programming model Visual Basic.NET, Jscript.NET, C# Namespaces Richer XML features and integration XCopy/FTP deployment Better reliability and recovery Excellent Visual Studio designer support Wednesday, March 23, 2016 Software Incubator 18 ASP.NET ASP.NET is compiled, not interpreted Better performance Early binding, strong typing, JIT compiling to native code Configuration settings in XML-based files Session state can now be shared across a web farm of ASP.NET servers .NET State Server Process manages state Application state is still single sever ASP.NET detects and recovers from problems Access violations, memory leaks, deadlocks ASP.NET supports pre-emptive cycling of apps Time and request based settings Wednesday, March 23, 2016 Software Incubator 19 ASP.NET ASP.NET,the platform services that allow to program Web Applications and Web Services in any .NET language ASP.NET Uses .NET languages to generate HTML pages. HTML page is targeted to the capabilities of the requesting Browser ASP.NET “Program” is compiled into a .NET class and cached the first time it is called. All subsequent calls use the cached version. Wednesday, March 23, 2016 Software Incubator 20 ASP.NET Logical Evolution of ASP Supports multiple languages Improved performance Control-based, event-driven execution model More productive Cleanly encapsulated functionality Wednesday, March 23, 2016 Software Incubator 21 ASP.NET Web Services A technical definition “A programmable application component accessible via standard Web protocols” Wednesday, March 23, 2016 Software Incubator 22 Web Services It is just an application… …that exposes its features and capabilities over the network… …using XML… …to allow for the creation of powerful new applications that are more than the sum of their parts… Wednesday, March 23, 2016 Software Incubator 23 ASP.NET Server Controls Server controls are tags that are understood by the server. There are three kinds of server controls: HTML Server Controls - Traditional HTML tags Web Server Controls - New ASP.NET tags Validation Server Controls - For input validation Wednesday, March 23, 2016 Software Incubator 24 ASP.NET Web Forms Allows clean cut code Code-behind Web Forms Easier for tools to generate Code within is compiled then executed Improved handling of state information Support for ASP.NET server controls Data validation Data bound grids Wednesday, March 23, 2016 Software Incubator 25 ADO.NET (Data and XML) New objects (e.g., DataSets) Separates connected / disconnected issues Language neutral data access Uses same types as CLR Great support for XML Wednesday, March 23, 2016 Software Incubator 26 Visual Studio.NET Wednesday, March 23, 2016 Software Incubator 27 Visual Studio.NET Development tool that contains a rich set of productivity and debugging features Wednesday, March 23, 2016 Software Incubator 28 Visual Studio.NET Integrated Development Environment Visual Basic.NET Visual C++ Integration with .NET Framework with managed extensions (classes) C# Many language enhancements Inheritance,Overloading, Free Threading New development language Based on C/C++ with Garbage Collection/Memory Management JUMP (Java User Migration Path) to .NET (1/25/01) Visual J++ has been removed from the Visual Studio suite currently but it was a part of the earlier versions. Wednesday, March 23, 2016 Software Incubator 29 VS.NET Features Single IDE for all Languages Server Explorer Event Viewer, Message Queues, Services SQL Databases, Data Connection, Etc. Integrated IE Browser HTML/XML Editors Macros/Macro Explorer Solution Explorer Tabbed Documents Dynamic Help Common Forms Editor VB.NET, C++, and C# Wednesday, March 23, 2016 Software Incubator 30 C# Wednesday, March 23, 2016 Software Incubator 31 Intro to C# Design Goals of C# Features Component Orientated Language Robust and Durable Software Classes Namespaces No header files VB.NET vs. C# Ability to embed C++ code in C# code Elegance of C/C++ language Wednesday, March 23, 2016 Software Incubator 32 Design Goals C# Component Oriented Robust and Durable Properties, methods, events Garbage collection (No memory leaks and stray pointers) Exception Handling Type-safety (No uninitialized variables) Based on C++ Interoperability Support for XML, SOAP Wednesday, March 23, 2016 Software Incubator 33 IIS – Internet Information Services Internet Information Service IIS (Internet Information Services) is Microsoft's Internet server IIS comes as a free component with Windows servers IIS is also a part of Windows 2000 and XP Professional How to install Wednesday, March 23, 2016 Software Incubator 34 How does ASP.NET work? Requests an HTML file, the server returns the file Requests an ASP.NET file, IIS passes the request to the ASP.NET engine on the server The ASP.NET engine reads the file, line by line, and executes the scripts in the file ASP.NET file is returned to the browser as plain HTML Wednesday, March 23, 2016 Software Incubator 35 J2EE and .NET Execution Engine J2EE Java source code compiles into machineindependent byte code Runtime Environment : JVM .NET Any compliant language compiles into MSIL Runtime environment : CLR Both JVM and CLR ,support services, such as code verification, memory management via garbage collection, and code security J2EE and .NET Cross Platform Portability J2EE Platform Independent JDK should exist on target machine .NET Supports Windows platform CLR should exist on target machine Can support other platforms provided it has its own JIT complier J2EE and .NET Language Support J2EE Tied to Java Supports other languages via interface technology .NET Language independent Supports any language if mapping exists from that language to IL J2EE and .NET Tools Support J2EE Can employ any number of tools Pro :Developer has a great deal of choice Con :Difficulty in choosing a right tool for a given job .NET Visual Studio.NET, single IDE for building an application Questions/Queries ?? Visit us @ www.akgec.org/si Course material available at www.akgec.org/si/downloads Wednesday, March 23, 2016 Software Incubator 40