net,asp .net, angular js,linq

32
.NET framework Presented by- Avijit Shaw

Upload: avijit-shaw

Post on 23-Jan-2018

216 views

Category:

Software


2 download

TRANSCRIPT

Page 1: NET,ASP .NET, Angular Js,LinQ

.NET framework

Presented by-

Avijit Shaw

Page 2: NET,ASP .NET, Angular Js,LinQ

What is the .NET Framework?

The .NET Framework is a platform created by Microsoft for developing applications

platform for application developers.

Framework that supports Multiple Language and Cross language integration.

IT has IDE (Integrated Development Environment).

Platform independent but with help of Mono Compilation System (MCS). MCS is a middle level

interface.

Provides interoperability between languages i.e. Common Type System (CTS) .

.NET Framework consists of a large library of code.

Page 3: NET,ASP .NET, Angular Js,LinQ

Core Features of .NET -

Interoperability: Existing COM binaries can shuffle with newer .NET binaries and vice

versa. In .NET 4.0, it has been further simplified with the “dynamic” keyword.

Support programming languages: Various types of languages supported by .NET like

C#,C++,Visual Basic etc.

Common runtime engine: This engine has a well-defined set of types that each .NET-

aware language understands.

Complete language integration: .NET supports cross-language inheritance, exception

handling, and debugging of code.

Comprehensive class library: This library provides a simple structure in contrast with

complexities of raw API calls and offers a common consistent object model.

Page 4: NET,ASP .NET, Angular Js,LinQ

Architecture-

Page 5: NET,ASP .NET, Angular Js,LinQ

Common Terms -

Common Language Runtime (CLR): The heart of the .Net Framework. It is also

called the .Net runtime. It resides above the operating system and handles all .Net

applications. It provides services including

I. memory management

II. garbage collection

III. exception handling

Common Type System" (CTS): CTS describes how types are declared, used and

managed in the runtime .

It facilitates cross-language integration type safety and high performance code

execution. Common type system brings all .Net languages data types on a common

platform.

Page 6: NET,ASP .NET, Angular Js,LinQ

Common Language Specification (CLS): CLS is the collection of the rules and

constraints that every language (that seeks to achieve .NET compatibility) must follow.

It is a subsection of CTS and it specifies how it shares and extends one another

libraries.

Microsoft Intermediate Language (MSIL) Code: When we compile our .Net code

then it is not directly converted to native/binary code.

it is first converted into intermediate code known as MSIL code which is then

interpreted by the CLR.

MSIL is independent of hardware and the operating system. Cross language

relationships are possible since MSIL is the same for all .Net languages.

MSIL is further converted into native code.

Just in Time Compilers (JIT): It compiles IL code into native executable code (exe or

dlls). Once code is converted to IL then it can be called again by JIT instead of

recompiling that code.

Page 7: NET,ASP .NET, Angular Js,LinQ

Framework class library: The .Net Framework provides a huge class library

called FCL for common tasks.

It contains thousands of classes to access Windows APIs and common functions like

string manipulations, Data structures, stream, IO, thread, security etc.

Assemblies :When you compile an application, the MSIL code created is stored in an

assembly.

Assemblies include both executable application files that you can run directly from

Windows without the need for any other programs (these have a .exe file extension),

and libraries (which have a .dll extension) for use by other applications.

assemblies also include meta information (that is, information about the information

contained in the assembly, also known as metadata) and optional resources (additional

data used by the MSIL, such as sound files and pictures).

Page 8: NET,ASP .NET, Angular Js,LinQ

Net Code Compilation and Execution process

During the compile time Metadata created with Microsoft Intermediate Language

(MSIL) and stored in a file called a Manifest . Both Metadata and Microsoft

Intermediate Language (MSIL) together wrapped in a Portable Executable (PE) file.

Portable Executable (PE) file =MSIL + MetaData

Page 9: NET,ASP .NET, Angular Js,LinQ

ASP .NET

Page 10: NET,ASP .NET, Angular Js,LinQ

What is the ASP .NET ?

ASP.NET is a development framework for building web pages and web sites with

HTML, CSS, JavaScript and server scripting.

ASP.NET supports different development models:

Web Pages, MVC (Model View Controller), and Web Forms.

What is Web Forms?

Web Forms is the oldest ASP.NET programming model, with event driven web pages

written as a combination of HTML, server controls, and server code.

Web Forms are compiled and executed on the server, which generates the HTML that

displays the web pages.

Page 11: NET,ASP .NET, Angular Js,LinQ

What happens when request comes ?

Whenever the user requests for a web page the request goes to IIS. IIS then checks the

ISAPI (Internet Server Application Programming Interface) extension of the request to

check how to process the request. If the request is for an .aspx page then the request will be

redirected to the ASP.NET.

Understanding the Page Life Cycle

A page life cycle basically consist of:

Start

Initialize

Load

Validate

Event Handling

Render

Unload

Page 12: NET,ASP .NET, Angular Js,LinQ

The Start phase is not associated with any event. It is just to indicate that the request has

been passed on to the page. Similarly the Validate and Event handling is not associated

with any predefined event. Its just that the validation will occur once the Load is done and

the user defined controls' events will be fired after validation and before Render.

For rest of the phases i.e. Initialize, Load, Render and Unload there are predefined events

associated with them

Page Life Cycle Events:

PreInit

Init

InitComplete

Preload

Load

LoadComplete

PreRender

PreRenderComplete

Unload

Page 13: NET,ASP .NET, Angular Js,LinQ

MVC Model

MVC is a framework for building web applications using a MVC (Model View

Controller) design:

The Model represents the application core (for instance a list of database records).

The View displays the data (the database records).

The Controller handles the input (to the database records).

Page 14: NET,ASP .NET, Angular Js,LinQ

Angular JS

Page 15: NET,ASP .NET, Angular Js,LinQ

What is AngularJS?

AngularJS is a client side JavaScript MVC framework to develop a dynamic web

application.

AngularJS was originally started as a project in Google but now, it is open source

framework.

AngularJS is a JavaScript framework. It’s library written in JavaScript.

AngularJS is distributed as a JavaScript file, and can be added to a web page with a

script tag:

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

Page 16: NET,ASP .NET, Angular Js,LinQ

Features-

MVC Architecture

The idea behind using this design pattern (architecture, is to split the web

application into a more manageable structure. The MVC architecture comprises of three

important elements, the model, view and controller.

Two Way Data Binding

In two-way data binding, any change made in the view will reflect in model, similarly

changes made in the model will reflect in the view. It is a two way process

In Angular, we need to use the ng-model directive to create a two-way data binding. This

directive will bind the model to the view. We'll do an example to understand the process

better.

Page 17: NET,ASP .NET, Angular Js,LinQ

Directives

AngularJS lets you extend HTML with new attributes called Directives.

AngularJS has a set of built-in directives which offers functionality to your

applications.

AngularJS also lets you define your own directives.

AngularJS directives are extended HTML attributes with the prefix ng-

The ng-app directive tells AngularJS that the <div> element is the "owner" of an

AngularJS application.

The ng-model directive binds the value of HTML controls (input, select, textarea) to

application data.

The ng-bind directive binds application data to the HTML view.

Page 18: NET,ASP .NET, Angular Js,LinQ

<!DOCTYPE html>

<html>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

<body>

<div ng-app="" ng-init="firstName=‘Avijit'">

<p>Input something in the input box:</p>

<p>Name: <input type="text" ng-model="firstName"></p>

<p>You wrote: {{ firstName }}</p>

</div>

</body>

</html>

Page 19: NET,ASP .NET, Angular Js,LinQ

Some Other Directives :-

Ng-blur

Ng-dblclick

Ng-repeat

Ng-click

Ng-enable/ng-disable

Ng-hide/ng-show

Ng-view

Ng-if

Ng-switch

Ng-submit

Ng-value

Page 20: NET,ASP .NET, Angular Js,LinQ

Expressions

Angular Expressions are JavaScript like expressions, however with lots of difference.

Written inside two curly braces, these expressions will bind Angular application data to

HTML elements.

{{ ----- }}

Modules

An AngularJS module defines an application.

The module is a container for the application controllers.

The architecture helps in designing Angular application by splitting the app into little

manageable structures. The Modules are pillar of this architecture. A module creates a well-

defined structure, which will keep everything organized, at one place.

A single application may more than one module. By creating a new module, each

application is first initialized and registered.

Page 21: NET,ASP .NET, Angular Js,LinQ

<script>

// INITIALIZE FIRST APP.

var mailApp = angular.module('myMails', []);

// INITIALIZE THE SECOND APP.

var bullionApp = angular.module('myMoney', []);

<script>

Adding a Controller

Page 22: NET,ASP .NET, Angular Js,LinQ

Scope

The scope is the binding part between the HTML (view) and the JavaScript (controller).

The scope is available for both the view and the controller.

How to Use the Scope?

When you make a controller in AngularJS, you pass the $scope object as an argument:

Page 23: NET,ASP .NET, Angular Js,LinQ

Filters

An Angular Filter modifies the data before presenting it to the user. We can use these

filters with expressions and directives. A filter is usually a predefined keyword, used with

the symbol “|” (a pipe).

Page 24: NET,ASP .NET, Angular Js,LinQ

Entity Framework

Page 25: NET,ASP .NET, Angular Js,LinQ

What is Entity Framework?

released in 2008

means of interacting between .NET applications and relational databases.

Page 26: NET,ASP .NET, Angular Js,LinQ

EF is an Object Relational Mapper (ORM) which is a type of tool that simplifies

mapping between objects in your software to the tables and columns of a relational

database.

Entity Framework (EF) is an open source ORM framework for ADO.NET which is a

part of .NET Framework.

An ORM takes care of creating database connections and executing commands, as

well as taking query results and automatically materializing those results as your

application objects.

Code First Approach

Page 27: NET,ASP .NET, Angular Js,LinQ

In the Code First approach, first we write your Doamin classes first and then create

database from these classes.

Database First Approach

The Database First Approach creates the entity framework from an existing database firstly.

Page 28: NET,ASP .NET, Angular Js,LinQ

LINQ

Language-Integrated Query (LINQ) is a powerful query language introduced with .Net

3.5 & Visual Studio 2008

LINQ can be used with C# or Visual Basic to query different data sources.

For example, SQL is a Structured Query Language used to save and retrieve data from a

database. In the same way, LINQ is a structured query syntax built in C# and VB.NET

used to save and retrieve data from different types of data sources like an Object

Collection, SQL server database, XML, web service etc.

LINQ always works with objects

Page 29: NET,ASP .NET, Angular Js,LinQ
Page 30: NET,ASP .NET, Angular Js,LinQ

Advantages of LINQ:

Familiar language: Developers don’t have to learn a new query language for each type

of data source or data format.

Less coding: It reduces the amount of code to be written as compared with a more

traditional approach.

Readable code: LINQ makes the code more readable so other developers can easily

understand and maintain it.

Standardized way of querying multiple data sources: The same LINQ syntax can be

used to query multiple data sources.

Compile time safety of queries: It provides type checking of objects at compile time.

IntelliSense Support: LINQ provides IntelliSense for generic collections.

Shaping data: You can retrieve data in different shapes.

Page 31: NET,ASP .NET, Angular Js,LinQ

LINQ Syntax

There are two basic ways to write a LINQ query:

1. Query Syntax or Query Expression Syntax

2. Method Syntax or Method extension syntax or Fluent

Query Syntax:

Query syntax is similar to SQL (Structured Query Language) for a database.

Query Syntax starts with from clause and can be ends with Select or GroupBy clause.

Page 32: NET,ASP .NET, Angular Js,LinQ

LINQ Method Syntax:

Method syntax (also known as fluent syntax) uses extension methods included in

the Enumerable or Queryable static class, similar to how you would call the extension

method of any class.