Slide 1
Slide 1
NET Framework
• .Net Framework is a software development platform for building and running Windows
applications.
• .Net framework includes developer tools, programming languages, and libraries that are
used to develop desktop and web applications.
• .NET Framework is compatible with Windows OS(operating system) only
.NET CORE
• .NET Core is a latest version of .NET Framework, which is a free, open-source, general-
purpose development platform maintained by Microsoft.
• It is a cross-platform framework that runs on Windows, macOS, and Linux operating
systems
• It optimized for modern app needs and developer workflows.
• It provides high scalability and performance in comparison to .NET Framework because
of its architecture.
• It can be used to build different types of applications such as mobile, desktop, web, cloud,
IoT, machine learning, microservices, game, etc.
CONTD…
• It is written from scratch to make it modular, lightweight, fast, and cross-platform
Framework.
• It includes the core features that are required to run a basic .NET Core app.
• Other features are provided as NuGet packages, which we can add it in your application
as needed.
• In this way, the .NET Core application speed up the performance, reduce the memory
footprint and becomes easy to maintain.
.Net Core Features
Open-source Framework:
.NET Core is an open-source framework maintained by Microsoft and available on
GitHub under MIT and Apache 2 licenses.
It is a .NET Foundation project.
Cross-platform:
.NET Core runs on Windows, macOS, and Linux operating systems.
There are different runtime for each operating system that executes the code and
generates the same output.
Consistent across Architectures:
Execute the code with the same behavior in different instruction set architectures,
including x64, x86, and ARM.
Wide-range of Applications:
Various types of applications can be developed and run on .NET Core platform such as
mobile, desktop, web, cloud, IoT, machine learning, microservices, game, etc.
Supports Multiple Languages:
We can use C#, F#, and VB programming languages to develop .NET Core applications.
Modular Architecture:
.NET Core supports modular architecture approach using NuGet packages.
It reduces the memory footprint, speeds up the performance, and easy to maintain.
CLI Tools:
.NET Core includes CLI tools (Command-line interface) for development and
continuous-integration.
Flexible Deployment:
Applications can be deployed user-wide or system-wide or with Docker Containers.
Compatibility:
Compatible with .NET Framework and Mono APIs by using .NET Standard
specification
.NET CORE FRAMEWORK PARTS
• CLI Tools: A set of tooling for development and deployment.
• Roslyn: Language compiler for C# and Visual Basic
• CoreFX: Set of framework libraries.
• CoreCLR: A JIT based CLR (Command Language Runtime).
MONO
• The Mono framework is an open source implementation of Microsoft’s .NET Framework
based on the open standards for the C# language and the Common Language Runtime.
• The Mono project has been in active development for over a decade and is used behind
the scenes - in many products.
• Mono allows C# developers to write cross platform code targeting Windows, macOS,
Linux, Android, and iOS.
• The technology was originally developed by Ximian, which was acquired by Novell, then
at Novell, then at Xamarin and now Microsoft.
• Mono provides a complete SDK (compiler, runtimes, libraries) to develop .NET
applications on a wide range of platforms.
CONTD…
• It is most commonly used as a .NET runtime that supports the .NET desktop API profile,
as well as an embeddable runtime that is used to power mobile platforms and gaming
consoles.
ASP.NET WEB FORM
Model:
Classes that represent the data of the application and that use validation logic to enforce
business rules for that data.
It is the part of the application that handles the logic for the application data.
Often model objects retrieve data (and store data) from a database.
CONTD…
Views:
A view display data(database record)that dynamically generate HTML responses.
Multiple views of the same data are possible.
It is the parts of the application that handles the display of the data.
Most often the views are created from the model data.
Controllers:
Classes that handle incoming browser requests(user interaction), retrieve model data, and
then specify view templates that return a response to the browser.
Typically controllers read data from a view, control user input, and send input data to the
model.
Advantages Of ASP.NET MVC Framework
• It manages application complexity by dividing an application into the
model, view and controller.
• It does not use view state or server-based forms. This makes the MVC
framework ideal for developers who want full control over the behavior of
an application.
• It provides better support for test-driven development.
• It is suitable for large scale developer team and web applications.
• It provides high degree of control to the developer over the application
behavior.
ASP.NET WEB API
• ASP.NET Web API is a framework that makes it easy to build HTTP
services that reach a broad range of clients, including browsers and mobile
devices.
• ASP.NET Web API is an ideal platform for building RESTful applications
on the . NET Framework.
• Web API services are used when the application is to be used on a
distributed system.
• Endpoints automatically serialize the classes to properly formatted JSON
out of the box. No special configuration is required.
CONTD…
• Secure API endpoints with built-in support for industry standard JSON Web Tokens
(JWT).
• Policy-based authorization gives you the flexibility to define powerful access control
rules—all in code.
• We define routes and verbs inline with your code, using attributes.
• Data from the request path, query string, and request body are automatically bound to
method parameters.
ASP.NET CORE
• ASP.NET Core is a cross-platform, high-performance, open-source framework for
building modern, cloud-enabled, Internet-connected apps.
• Build web apps and services, Internet of Things (IoT) apps, and mobile backends.
• Use development tools on Windows, macOS, and Linux.
• Deploy to the cloud or on-premises.
• Run on .NET Core.
ASP.NET CORE Benefits
• A unified model for building web UI and web APIs.
• Architected for testability.
• Razor Pages makes coding page-focused scenarios easier and more productive.
• Ability to develop and run on Windows, macOS, and Linux.
• Open-source and community-focused.
• Integration of modern, client-side frameworks and development workflows.
• A cloud-ready, environment-based configuration system.
• Built-in dependency injection.
• A lightweight, high-performance, and modular HTTP request pipeline.
CONTD…
• .NET Core includes CLI tools (Command-line interface) for development and
continuous-integration.
.NET Architecture And Design Principles
• .NET is tiered, modular, and hierarchal.
• Each tier of the .NET Framework is a layer of abstraction.
• .NET languages are the top tier and the most abstracted level.
• The common language runtime is the bottom tier, the least abstracted, and closest to the
native environment.
• Common language runtime works closely with the operating environment to
manage .NET applications.
• The .NET Framework is partitioned into modules, each with its own distinct
responsibility.
• Finally, since higher tiers request services only from the lower tiers, .NET is hierarchal.
DESIGN PRINCIPLES OF .NET
• Interoperability
• Portability
• In-built security mechanism
• Robust memory management
• Simplified deployment
• Asynchronous Programming
• High Performance
Compilation And Execution Of .NET Applications: CLI,
MSIL AND CLR
• The Common Language Infrastructure (CLI) is an open specification developed by
Microsoft that describes the executable code and runtime environment that allows
multiple high-level languages to be used on different computer platforms without being
rewritten for specific architectures.
• The .NET Framework, .NET Core, and Mono are some implementations of CLI.
• Source code written in C# is compiled into an Microsoft Intermediate Language (MSIL)
that conforms to the CLI specification. The IL code are stored on disk in an executable
file called an assembly, typically with an extension of .exe or .dll
• CLR performs just in time (JIT) compilation to convert the IL code to native machine
instructions. The CLR also provides other services related to automatic garbage
collection, exception handling, and resource management.
CONTD…
• CLR is the responsibility of the runtime to take care the code execution of the program.
• CLR is a framework layer that resides above the OS and handles the execution of all
the .Net applications. Programs don’t directly communicate with the OS but go through
the CLR.
• CLR manages memory, thread execution, code execution, code safety verification,
compilation, and other system services.
NET CLI: Build, Run, Test And Deploy .NET Core
Applications
• The .NET command-line interface (CLI) is a cross-platform toolchain for developing,
building, running, and publishing .NET applications.
• The .NET Core CLI is installed with .NET Core SDK for selected platforms.
• Visual Studio internally uses this CLI to restore, build and publish an application. Other
higher level IDEs, editors and tools can use CLI to support .NET Core applications.
• We can verify whether the CLI is installed properly by opening command prompt in
Windows and writing dotnet and pressing Enter.
• If it displays usage and help as shown below then it means it is installed properly.
.NET Core CLI Command Structure:
• dotnet <command> <argument> <option>
CREATING AND RUNNING THE HELLO WORLD CONSOLE
APPLICATION
The command dotnet new console creates a new Hello World console application in the current folder.
The dotnet new console command creates two files:
• Program.cs and
• hwapp.csproj
CONTD…
using System;
namespace hwapp
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
}
Run Project
• Run the Hello World application by executing dotnet run at the command line or
terminal.