KEMBAR78
Unit-1: Multilanguage Development | PDF | Class (Computer Programming) | Client–Server Model
0% found this document useful (0 votes)
8 views29 pages

Unit-1: Multilanguage Development

The document provides an overview of the Microsoft .NET platform, highlighting its key features such as multilanguage development, platform independence, automatic memory management, and security mechanisms. It also covers the architecture of .NET, including the Common Language Runtime and the Framework Class Library, along with the advantages of using .NET for application development. Additionally, it explains object-oriented programming concepts like classes, objects, abstraction, encapsulation, and inheritance in the context of C#.

Uploaded by

soniyash4095
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views29 pages

Unit-1: Multilanguage Development

The document provides an overview of the Microsoft .NET platform, highlighting its key features such as multilanguage development, platform independence, automatic memory management, and security mechanisms. It also covers the architecture of .NET, including the Common Language Runtime and the Framework Class Library, along with the advantages of using .NET for application development. Additionally, it explains object-oriented programming concepts like classes, objects, abstraction, encapsulation, and inheritance in the context of C#.

Uploaded by

soniyash4095
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

UNIT- 1 Microsoft .

Net Platform and Fundamentals

Features of Microsoft .Net Platform


Multilanguage Development: The. NET framework compilers convert the source
code into Microsoft Intermediate Language (MSIL), which is the reason for this.
NET’s multilingual capability. Your code is Compiled from IL and is interoperable with
code from another language.

Platform and Processor independent: platform and processor independent”


means that a software Application or system can run on different operating systems
(platforms) and hardware architectures (processors) without any major modifications
or issues. This characteristic is highly desirable for Software Developers because it
allows them to write code once and deploy it on various platforms and processors
Without having to recompile or rewrite significant portions of the codebase.

Automatic Memory Management: Automatic Memory Management is achieved


through the Common Language Runtime (CLR), which is the virtual machine
component of the .NET framework responsible for Executing managed code. The
CLR employs a garbage collection mechanism to automatically manage Memory for
.NET applications, including those written in languages like C#, VB.NET, and F#.

Garbage Collection (GC) The CLR’s Garbage Collector is responsible for identifying
and reclaiming Memory that is no longer in use by the application. It periodically
scans the managed heap (the portion Of memory used for storing objects created
during the program’s execution) to find objects that are no longer reachable or
referenced by the application.

Easy Deployment: Another benefit introduced with .NET Core (and followed in .NET
5 and later) is the Side-by-side installation, which allows you to straightforwardly
deploy several applications. Each application runs with different versions of .NET on
the same computer without making the applications Break each other. This setup
has led to more convenience and flexibility in application deployment that was not
possible in The .NET Framework since the .NET Framework is a Windows
component that has to be replaced with Each new version.

Distributed architecture: in .NET refers to the design and implementation of


software systems that are composed of multiple components or services running on
separate machines and communicating with Each other over a network. This
approach is often used to build scalable, flexible, and resilient Applications that can
handle high loads and provide better performance and fault tolerance.

Interoperability with Unmanaged code: .NET allows managed code (written in C#


or other .NET Languages) to work seamlessly with unmanaged code, typically
written in languages like C or C++. This is particularly useful when integrating
existing legacy code, leveraging specialized libraries, or accessing Operating system
features not natively available in. NET.

Security:

1. Code Access Security (CAS): In earlier versions of .NET, Code Access


Security (CAS) was used to control the permissions of managed Code based
on the code’s origin, identity, and location. However, starting with .NET 4.0,
CAS was Deprecated in favor of using other security mechanisms like
sandboxing and permission sets.
2. Common Language Runtime (CLR) Security Policy: The CLR provides a
security policy system that determines the level of trust granted to assemblies
based On their origin and strong names. Administrators can use tools like
“Caspol.exe” (Code Access Security Policy Tool) to configure security policies
for different code groups and grant specific permissions to Assemblies.
3. Secure Coding Practices: .NET promotes secure coding practices to avoid
common security vulnerabilities, such as SQL injection, Cross-site scripting
(XSS), cross-site request forgery (CSRF), and others. Developers are
encouraged to use Parameterized queries, validate input data, and sanitize
user input to prevent these attacks.
4. Cryptography API: .NET includes a robust Cryptography API that offers
classes for cryptographic operations, including Encryption, hashing, digital
signatures, and secure random number generation. Developers can use these
Classes to ensure data confidentiality and integrity.
5. Secure string: The secure string class provides a secure way to store
sensitive information, like passwords, in memory. Unlike regular strings, which
are immutable and remain in memory for an extended period, secure string
Encrypts the data and can be securely wiped from memory when no longer
needed.
6. ASP.NET Security: ASP.NET provides various security features to protect
web applications, such as built-in request Validation, output encoding, and
authentication mechanisms (Forms Authentication, Windows Authentication,
etc.). It also offers role-based authorization and the ability to create custom
Authentication and authorization providers.
7. Identity and Access Management (IAM): With the advent of .NET Core and
ASP.NET Core, Microsoft introduced the Identity framework, which Simplifies
user authentication, identity management, and social login integration. It
supports various Authentication protocols like OAuth, OpenID Connect, and
JWT (JSON Web Tokens).
8. Cross-Site Request Forgery (CSRF) Protection: ASP.NET includes built-in
mechanisms to protect against Cross-Site Request Forgery attacks. The
Antiforgerytoken feature helps prevent unauthorized form submissions in web
applications.
9. Secure Sockets Layer (SSL) Support: .NET allows applications to establish
secure communications using SSL/TLS protocols for protecting data
transmitted over the network.
10. Role-Based Security: .NET provides facilities for role-based security,
allowing administrators to define roles and assign Permissions to users based
on their roles. This is commonly used to control access to specific functionality
within an application.

Performance and scalability: are essential aspects of software development,


including applications built on the .NET framework. Optimizing performance ensures
that your application runs efficiently, responds Quickly, and consumes resources
judiciously. Scalability, on the other hand, refers to the ability of your application to
handle increasing loads by distributing resources effectively.

Component of the .NET Architecture


The two major components of the .NET Framework are the Common Language
Runtime and the .NET Framework Class Library.

 Common Language Specification (CLS): The CLS is a set of rules and


guidelines that language compilers must follow to ensure language
interoperability within the .NET Framework. By adhering to the CLS, language
developers can create components that can be used by other. NET-compliant
languages.
 Common Type System (CTS): The CTS defines the data types that are
common across all .NET languages. It ensures that different .NET languages
can interoperate seamlessly, allowing objects created in one language to be
used in another language within the same .NET application.
 Framework Class Library (FCL): It provides the various system functionality
in the .NET Framework, which includes classes, interfaces, and data types,
etc. to create multiple functions and different types of applications such as
desktop, web, mobile application, etc. In other words, it can be defined as, it
provides a base on which various applications, controls, and components are
built in .NET Framework.

 The Common Language Runtime (CLR) is the execution engine that


handles running applications. It provides services like thread management,
garbage collection, type safety, exception handling, and more.
 The Base Class Library provides a set of APIs and types for common
functionality. It provides types for strings, dates, numbers, etc. The Class
Library includes APIs for reading and writing files, connecting to databases,
drawing, and more.
 Common Language Infrastructure (CLI): is a standard developed by
Microsoft that allows the use of multiple different high-level languages on
different computer platforms without rewriting the code for any specific
architecture. In simple terms, Common Language Infrastructure (CLI) enables
an application program written in any commonly-used programming language
to be run on any operating system using a common runtime program rather
than a specific one for every language.
.NET applications are written in the C#, F#, or Visual Basic programming language.
Code is compiled into a language-agnostic Common Intermediate Language (CIL).
Compiled code is stored in assemblies—files with a .dll or .exe file extension.
When an app runs, the CLR takes the assembly and uses a just-in-time compiler
(JIT) to turn it into machine code that can execute on the specific architecture of the
computer it is running on.

Advantages of the .NET Platform


Cross-platform compatibility: .NET, the open-source implementation of .NET,
allows you to develop applications that run on various platforms, including Windows,
macOS, and Linux. This flexibility is crucial in today’s multi-platform world.
Language interoperability: .NET supports multiple programming languages,
including C#, Visual Basic.NET, F#, and more. This enables developers to use the
language they are most comfortable with, making it easier to build complex
applications.
Rich class library: .NET comes with an extensive class library called the Base
Class Library (BCL). The BCL provides pre-built code for common programming
tasks, saving developers time and effort by not having to reinvent the wheel for every
feature.
Security: .NET has built-in security features, such as code access security (CAS), to
protect applications from malicious code and unauthorized access. Additionally,
ASP.NET provides features like request validation and authentication mechanisms to
enhance security for web applications.
Easy deployment: .NET applications can be easily deployed using an XCOPY or
container-based approach This simplifies the deployment process, reducing the
chances of configuration errors and making updates more manageable.
Performance: With the introduction of .NET Core, performance improvements have
been made, resulting in faster execution times and reduced memory consumption.
This is especially beneficial for web applications and services handling high loads.
Integrated development environment (IDE) support: .NET development is well-
supported by Microsoft’s Visual Studio IDE, which offers a rich set of tools for code
editing, debugging, testing, and deployment.
Scalability: .NET allows applications to be easily scaled up or down, making it
suitable for projects of varying sizes and complexity. This is particularly important for
enterprise-level applications that need to handle a large number of users and data.
Active community and documentation: .NET have a large and active developer
community, providing access to vast resources, tutorials, and libraries. The
availability of documentation and community support makes it easier for developers
to troubleshoot issues and learn new features.
Integration with Microsoft technologies: If your project requires integration with
other Microsoft technologies like SharePoint, Dynamics 365, or Azure services, .NET
provides seamless integration options, streamlining development processes.
Overall, NET’s versatility, language support, performance, and integration
capabilities make it a popular choice for building a wide range of applications, from
desktop software to web applications and cloud-based services.

C# - What is OOP?
OOP stands for Object-Oriented Programming.

Procedural programming is about writing procedures or methods that perform


operations on the data, while object-oriented programming is about creating objects
that contain both data and methods.

Object-oriented programming has several advantages over procedural programming:

 OOP is faster and easier to execute


 OOP provides a clear structure for the programs
 OOP helps to keep the C# code DRY "Don't Repeat Yourself", and makes the
code easier to maintain, modify and debug
 OOP makes it possible to create fully reusable applications with less code and
shorter development time
Class

A class is a blueprint or a template for creating objects. It defines the structure and
behaviour of objects of that class type. A class encapsulates data (in the form of
attributes or properties) and behaviour (in the form of methods or functions).

Object

Objects are the basic run-time entities of an object-oriented system. They may
represent a person, a place, or any item the program must handle.

 "An object is a software bundle of related variables and methods."


 "An object is an instance of a class."

For example,

using System;

namespace MyApplication

class Car

string color = "red";

static void Main(string[] args)

Car myObj = new Car();

Console.WriteLine(myObj.color);

}
Abstraction

Abstraction is "To represent the essential feature without representing the


background details."

 The abstract keyword is used for classes and methods:


 Abstract class: is a restricted class that cannot be used to create objects (to
access it, it must be inherited from another class).

 Abstract method: can only be used in an abstract class, and it does not have
a body. The body is provided by the derived class (inherited from)

 Abstraction lets you focus on what the object does instead of how it does it.
 Abstraction provides a generalized view of your classes or objects by
providing relevant information.
 Abstraction is the process of hiding the working style of an object and showing
the information about an object understandably.

Real-world Example of Abstraction

Suppose you have an object Mobile Phone.

Suppose you have three mobile phones as in the following:

 Nokia 1400 (Features: Calling, SMS)


 Nokia 2700 (Features: Calling, SMS, FM Radio, MP3, Camera)
 BlackBerry (Features: Calling, SMS, FM Radio, MP3, Camera, Video
Recording, Reading E-mails)

So, for a mobile phone object, you will have the abstract class as in the
following,

abstract class MobilePhone {

public void Calling();

public void SendSMS();

public class Nokia1400: MobilePhone {}

public class Nokia2700: MobilePhone {

public void FMRadio();


public void MP3();

public void Camera();

public class BlackBerry: MobilePhone {

public void FMRadio();

public void MP3();

public void Camera();

public void Recording();

public void ReadAndSendEmails();

Encapsulation
Wrapping up a data member and a method together into a single unit (in other
words, class) is called Encapsulation. Encapsulation is like enclosing in a capsule.
That is, enclosing the related operations and data related to an object into that
object.
 Encapsulation means hiding the internal details of an object, in other words,
how an object does something.
 Encapsulation prevents clients from seeing its inside view, where the behavior
of the abstraction is implemented.
 Encapsulation is a technique used to protect the information in an object from
another object.
 Hide the data for security, such as making the variables private, and expose
the property to access the private data that will be public.
Example
class Bag {
book;
pen;
ReadBook();
}
Inheritance
When a class includes a property of another class, it is known as inheritance.
Inheritance is a process of object reusability.
Types of Inheritance
The inheritance concept is based on a base class and its derived classes. Let us see
the definition of base and derived classes.

 Derived Class (child) - the class that inherits from another class
 Base Class (parent) - the class being inherited from

Single inheritance in C#
It is the type of inheritance in which there is one base class and one derived class.
For example,
public class Accountcreditinfo //base class
{
public string Credit()
{
return "balance is credited";
}
}
public class debitinfo : Accountcreditinfo //derived class
{
public string debit()
{
Credit(); ////derived class method
return "balance is debited";
}
}
In the preceding sample program, Accountcreditinfo is the base class, and debitinfo
is the derived class.
Hierarchical inheritance in C#
This is the type of inheritance in which there are multiple classes derived from one
base class. This type of inheritance is used when there is a requirement of one class
feature that is needed in multiple classes.
For example,
class A //base class
{
public string msg()
{
return "this is A class Method";
}
}
class B : A
{
public string info()
{
msg();
return "this is B class Method";
}
class C : A
{
public string getinfo()
{
msg();
return "this is B class Method";
}
}
}
In the preceding program, one base class is derived from many classes; hence it is
called a Hierarchical Inheritance.
Multilevel inheritance in C#
When one class is derived from another, this type of inheritance is called multilevel
inheritance.
For example,
public class Person
{
public string persondet()
{
return "this is the person class";
}
}
public class Bird : Person
{
public string birddet()
{
persondet();
return "this is the birddet Class";
}
}
public class Animal : Bird
{
public string animaldet()
{
persondet();
birddet();
return "this is the Animal Class";
}
}
In the preceding program, each class is derived from one class that is derived from
another class hence this type of inheritance is called Multilevel Inheritance.

Multiple inheritances using Interfaces


C# does not support multiple inheritances of classes. To overcome this problem, we
can use interfaces. We will see more about interfaces in my next article in detail.
For example,
public interface IA //ineterface 1
{
string setImgs(string a);
}
public interface IB //Interface 2
{
int getAmount(int Amt);
}
public class ICar : IA, IB //implementatin
{
public int getAmount(int Amt)
{
return 100;
}
public string setImgs(string a)
{
return "this is the car";
}
}

Polymorphism
Polymorphism means one name, many forms. One function behaves in different
forms. In other words, "Many forms of a single object is called Polymorphism."
For example,
using System;

namespace MyApplication
{
class Animal // Base class (parent)
{
public void animalSound()
{
Console.WriteLine("The animal makes a sound");
}
}

class Pig: Animal // Derived class (child)


{
public void animalSound ()
{
Console.WriteLine("The pig says: wee wee");
}
}

class Dog : Animal // Derived class (child)


{
public void animalSound ()
{
Console.WriteLine("The dog says: bow wow");
}
}

class Program
{
static void Main (string [] args)
{
Animal myAnimal = new Animal (); // Create a Animal object
Animal myPig = new Pig (); // Create a Pig object
Animal myDog = new Dog (); // Create a Dog object

myAnimal.animalSound();
myPig.animalSound();
myDog.animalSound();
}
}
}
SQL Queries

SELECT statement: Retrieve data from a table.

SELECT column1, column2, ...


FROM table_name;

WHERE clause: Filter data based on certain conditions.

SELECT column1, column2, ...


FROM table_name
WHERE condition;
INSERT INTO: Add new records to a table.

INSERT INTO table_name (column1, column2, ...)


VALUES (value1, value2, ...);

UPDATE: Modify existing records in a table.

UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

DELETE: Remove records from a table.

DELETE FROM table_name


WHERE condition;

JOIN: Combine data from multiple tables.

SELECT column1, column2, ...


FROM table1
JOIN table2 ON table1.column_name = table2.column_name;

GROUP BY: Group data based on a column's values.

SELECT column1, COUNT(*)


FROM table_name
GROUP BY column1;

HAVING: Filter data after using GROUP BY.

SELECT column1, COUNT (*)


FROM table_name
GROUP BY column1
HAVING COUNT(*) > 1;
ORDER BY: Sort the result set.

SELECT column1, column2, ...


FROM table_name
ORDER BY column1 ASC/DESC, column2 ASC/DESC, ...;

LIMIT: Limit the number of rows returned.

SELECT column1, column2, ...


FROM table_name
LIMIT n;

Different Types of SQL JOINs

 (INNER) JOIN: Returns records that have matching values in both tables
 LEFT (OUTER) JOIN: Returns all records from the left table, and the matched
records from the right table
 RIGHT (OUTER) JOIN: Returns all records from the right table, and the
matched records from the left table
 FULL (OUTER) JOIN: Returns all records when there is a match in either left
or right table
Client And Server Standards Programs in .Net
Server: The server is the application, program, or computer that provides resources
to devices connected through the network.

1. Choose the Application Type: Decide on the type of server-side application


you want to build, such as a web application, web API, or service application.
2. Choose the .NET Platform: Depending on your requirements and target
platforms, you can choose between .NET Framework or .NET Core/.NET 5+.
.NET Core is recommended for new development due to its cross-platform
capabilities and performance improvements.
3. Create the Project: Use Visual Studio or Visual Studio Code to create a new
project for your chosen application type. You can also use the .NET CLI
(Command Line Interface) to create the project.
4. Define the Data Model: If your application interacts with a database, define
the data model using classes that represent the database tables. You can use
Entity Framework to simplify data access through an ORM.
5. Implement Business Logic: Write the business logic of your application.
This may include processing data, applying business rules, and interacting
with external services or APIs.
6. Create Web APIs (if applicable): If you are building a web API, use
ASP.NET Core Web API to define and implement the API endpoints that
clients can call to interact with your server-side application.
7. Implement Middleware (if applicable): In ASP.NET Core, you can use
middleware to handle cross-cutting concerns like authentication, logging, error
handling, etc.
8. Handle Requests and Responses: Depending on your application type,
handle incoming requests from clients (e.g., web browsers, mobile apps) and
generate appropriate responses.
9. Use Dependency Injection: Leverage the built-in dependency injection
feature of ASP.NET Core to manage and inject dependencies into your
classes.
10. Unit Testing: Write unit tests to ensure the correctness of your server-side
application's logic and functionality.
11. Configure Deployment: Configure deployment settings for your application,
including settings related to database connections, security, and any other
configurations specific to your environment.
12. Publish and Deploy: Publish your application and deploy it to the server or
cloud platform of your choice.
13. Monitoring and Maintenance: Set up logging and monitoring to keep track of
your application's performance and health. Regularly update and maintain
your server-side application as needed.
Client: The client is the application, program, and computer that relies on servers to
get resources.

client-side applications refer to applications that run on the client's machine, such as
web browsers or standalone desktop applications. These applications interact with
the server side to request and receive data, but most of the processing and
rendering happen on the client side. Here's an overview of a typical client-side
program in .NET:

1. Choose the Application Type: Decide on the type of client-side application


you want to build, such as a web application, desktop application, or mobile
application.

2. Choose the .NET Platform: Depending on your target platforms, you can
choose between different .NET technologies:
 For web applications: Consider using ASP.NET Core Razor Pages,
ASP.NET Core Blazor (WebAssembly), or ASP.NET Core Web API for
client-side interactions.
 For desktop applications: Choose between Windows Forms, Windows
Presentation Foundation (WPF), or .NET MAUI (for cross-platform
desktop applications).

3. Create the Project: Use Visual Studio or Visual Studio Code to create a new
project for your chosen client-side application type. Alternatively, use the .NET
CLI (Command Line Interface) to set up the project.

4. Define the User Interface: For web applications, design the user interface
using HTML, CSS, and JavaScript or Blazor components if you are using
Blazor. For desktop applications, design the UI using XAML (for WPF or .NET
MAUI) or Windows Forms designer (for Windows Forms).

5. Implement Client-side Logic: Write client-side logic using JavaScript for web
applications or C# (and XAML, if applicable) for desktop applications. For
Blazor applications, you can write C# code for the client-side logic.

6. Handle User Interactions: Implement event handlers to respond to user


interactions, such as button clicks, form submissions, etc.

7. Retrieve Data from Server: Use AJAX (Asynchronous JavaScript and XML)
requests or HTTP Client (for Blazor) to communicate with the server-side
application and retrieve data from APIs or web services.

8. Handle Responses from Server: Process the data received from the server
and update the UI accordingly.

9. Perform Client-side Validation: Validate user inputs on the client-side to


provide immediate feedback and reduce the load on the server.
10. Implement Navigation (for web applications): Set up client-side navigation
to allow users to move between different pages or sections of the application
without reloading the entire page.

11. Unit Testing (optional): Write unit tests for client-side logic to ensure
correctness and improve the overall quality of the application.

12. Optimization and Performance: Optimize client-side code, especially for


web applications, to reduce loading times and improve performance.

13. Packaging and Deployment: Package the client-side application for


distribution. For web applications, deploy it to a web server or a cloud
platform. For desktop applications, create an installer or distribute it through
app stores.

Benefits of the Client-Server model

Now that you are aware of a client-server model, let me point out some benefits of
this model (that I found helpful)
1. An entire application model is distributed in two different projects. I can easily
configure how each one shares the data and how each one accepts the data
from the network.

2. I can write the business logic on the server application and execute functions
on it. Maintaining the DRY rule of Don't repeat yourself.

3. I can share the client application with friends and keep my server running. It
takes less than 10 MB to run the server and that is great for such small and
compact applications. I can for sure add more features, such as
asynchronous programming to accept multiple requests from clients if I want
to.

4. Cross-platform data sharing across applications.

5. Console application
For simpler client applications.

6. Windows Presentation Foundation (or Windows Forms)


For many complex and GUI-oriented applications.

7. ASP.NET web application

Apart from this, the .NET Framework provides native .NET libraries and assemblies
that can be used to create network-oriented applications in the .NET Framework.
The System.Net namespace provides us with assemblies that we can use to work
around networking and protocols in .NET applications. There are many namespaces
under this namespace and I would talk about only a few. Namespaces that are
introduced or talked about in this article are:
System.Net: Core assembly for networking in .NET Framework. Also will be used in
our sample project.

System.Net.Mail: This namespace holds the objects used to send emails, connect
to SMTP servers, and other required operations.

System.Net.Security: Provides us with an object required to generate SSL-based


streams.
System.Net.Sockets: This namespace holds the objects for TCP or UDP
clients and listeners and clients for working around with the network based on these
protocols.

.NET Framework
.NET is a framework to develop software applications. It is designed and developed by
Microsoft and the first beta version was released in 2000.

It is used to develop applications for the web, Windows, and phones. Moreover, it
provides a broad range of functionalities and support.

This framework contains a large number of class libraries known as Framework Class
Library (FCL). The software programs written in .NET are executed in the execution
environment, which is called CLR (Common Language Runtime). These are the core
and essential parts of the .NET framework.

This framework provides various services like memory management, networking,


security, memory management, and type safety.

The .Net Framework supports more than 60 programming languages such as C#, F#,
VB.NET, J#, VC++, JScript.NET, APL, COBOL, Perl, Oberon, ML, Pascal, Eiffel, Smalltalk,
Python, Cobra, ADA, etc.

Following is the .NET framework Stack that shows the modules and components of the
Framework.

The .NET Framework is composed of four main components:

1. Common Language Runtime (CLR)


2. Framework Class Library (FCL),
3. Core Languages (WinForms, ASP.NET, and ADO.NET), and
4. Other Modules (WCF, WPF, WF, Card Space, LINQ, Entity Framework, Parallel LINQ, Task
Parallel Library, etc.)
CLR (Common Language Runtime)
It is a program execution engine that loads and executes the program. It converts the
program into native code. It acts as an interface between the framework and operating
system. It does exception handling, memory management, and garbage collection.
Moreover, it provides security, type-safety, interoperability, and portablility. A list of
CLR components are given below:

FCL (Framework Class Library)


It is a standard library that is a collection of thousands of classes and used to build an
application. The BCL (Base Class Library) is the core of the FCL and provides basic
functionalities.
WinForms
Windows Forms is a smart client technology for the .NET Framework, a set of managed
libraries that simplify common application tasks such as reading and writing to the file
system.

ASP.NET
ASP.NET is a web framework designed and developed by Microsoft. It is used to
develop websites, web applications, and web services. It provides a fantastic
integration of HTML, CSS, and JavaScript. It was first released in January 2002.

ADO.NET
ADO.NET is a module of .Net Framework, which is used to establish a connection
between applications and data sources. Data sources can be such as SQL Server and
XML. ADO .NET consists of classes that can be used to connect, retrieve, insert, and
delete data.
WPF (Windows Presentation Foundation)
Windows Presentation Foundation (WPF) is a graphical subsystem by Microsoft for
rendering user interfaces in Windows-based applications. WPF, previously known as
"Avalon", was initially released as part of .NET Framework 3.0 in 2006. WPF uses
DirectX.

WCF (Windows Communication Foundation)


It is a framework for building service-oriented applications. Using WCF, you can send
data as asynchronous messages from one service endpoint to another.

WF (Workflow Foundation)
Windows Workflow Foundation (WF) is a Microsoft technology that provides an API,
an in-process workflow engine, and a hostable designer to implement long-running
processes as workflows within .NET applications.

LINQ (Language Integrated Query)


It is a query language, introduced in .NET 3.5 framework. It is used to make the query
for data sources with C# or Visual Basics programming languages.

Entity Framework
It is an ORM-based open-source framework that is used to work with a database using
.NET objects. It eliminates a lot of developers’ effort to handle the database. It is
Microsoft's recommended technology to deal with the database.

Parallel LINQ
Parallel LINQ or PLINQ is a parallel implementation of LINQ to objects. It combines the
simplicity and readability of LINQ and provides the power of parallel programming.

It can improve and provide fast speed to execute the LINQ query by using all available
computer capabilities.

Apart from the above features and libraries, .NET includes other APIs and Model to
improve and enhance the .NET framework.

In 2015, Task parallel and Task parallel libraries were added. In .NET 4.5, a task-based
asynchronous model was added.
3-tier architecture in c#
This article briefly discusses the three-tier application in c#. A three-tier architecture
divides the project into three layers: the user interfaces layer, the business layer, and
the data (database) layer, and separates the UI, logic, and data into three layers.

If a user wants to change her UI from Windows to Phone, she can change the UI layer,
and the other layers will not be affected by this change. Otherwise, everything remains
the same.

Why do we use 3 tier application on any project?


We use a three-tier structure to control large projects. For instance, let us say you wrote
2000 entity codes and coded all the code in a single layer. Say you want to interchange
between home windows software and cellular or web applications, and you must
rewrite the code for all 2000 entities.

You must trade the database connection for all 2000 entities if you change the
database provider. Increase. So, writing a lot of code wastes money and time.
Additionally, writing numerous codes in layers makes it difficult for new humans to
apprehend them.

Advertisement

Therefore, a project should use a three-tier architecture to provide maintenance,


flexibility, update, and clean and understandable code without affecting other parts.
So, we use 3-tier architecture because of these points -

1. Accelerated development: Different teams can improve each layer simultaneously,


optimizing product time-to-market and allowing developers to use the latest tools and
the best languages for each layer.
2. Improved scalability: Each tier can always be scaled independently by deploying
applications in different tiers.
3. Improved Reliability: With different tiers, you can also run other parts of your
application on different servers and use cached results to enhance reliability and
availability.
4. Enhanced Security: Leverages a well-designed application layer as an internal firewall
that helps prevent SQL injection and other malicious exploits.

What is the difference between layer and tier?

Layer and tier are often used interchangeably, which is incorrect. The main difference
between layers and layers is how they are organized. In contrast, a tiered architecture
divides an application into many physical entities on separate infrastructures.

Another difference arises from the responsibility of the lowest-level component


of each architecture.

The data access layer does not provide data, so most of the time, the data resides in
the application layer (some designs are separated into one layer).

In this view, one level can contain multiple levels. For example, a mobile phone camera
application is n-tier. It is also called a single-tier application because all the processes
run on the phone.

Presentation Layer: The user interacts with the app to capture images.

Data Access Level: Apps access device memory to store processed information.

What are the three parts of the three-tier


architecture?
The three-tier architecture includes three tiers, these are –

1. Presentation Tier:
That is the pinnacle layer of the architecture. The top software layer is the personal
interface. It is related to her UI. This is displayed to the consumer. The primary feature
of this degree is to translate responsibilities and consequences into something the
consumer can understand.

This includes pages that include net forms, windows bureaucracy, etc., where records
are displayed to the consumer and used to acquire input from the user. The
presentation layer is the most vital because the person sees it, and an excellent
consumer interface draws the consumer, and this deposit needs to be well designed.

2. Business Tier:
This is the middle tier of the structure. This residue contains C# lessons, and logical
calculations and operations are completed below this layer. It also acts as a middleware
among the surrounding layers, the presentation, and the facts tiers. Procedure records
between those layers. This residue implements good business judgment and
calculations.

This layer also validates input conditions before calling methods from the data layer.
This ensures that the data input is correct before proceeding, and in many cases, the
output is also correct. This input validation is called a business rule.

3. Data Tier:
This tier connects the business tier to databases or data sources. Consists of strategies
used to carry out operations on the database, including insert, delete, and update. This
residue consists of saved approaches used to query the database. So, this residue
connects to the database and performs capabilities on the database.

Application of 3 tiers using C#:


This is the heart of the 3-tier architecture and the most complex and difficult
implementation layer. So, you need an excellent design to manage and organize your
code. Therefore, we used a 3-tier architecture for this tier.

This level does not interact with the user. Interact with other layers/applications. In
other words, the presentation layer (application layer) is not the user interface.

What are the advantages and drawbacks of 3-tier


architecture?
Advantages:
1. Data Provider queries can be easily updated, making applying OOP concepts to your
projects easy.
2. Updating to the new graphical environment is now easier and faster.
Drawbacks:
1. Complex and time-consuming to build.
2. This is more complicated than a simple client-server architecture.
3. Users should be familiar with object-oriented concepts.

.NET Core
.NET Core is a free, open-source, modular, cross-platform framework developed by Microsoft
for building modern, high-performance applications. It is a reimplementation of the .NET
Framework to be more lightweight, modular, and flexible.

.NET Core includes a runtime, a set of libraries, and a development environment that
supports multiple programming languages such as C#, Visual Basic, and F#. It is
designed to run on various platforms, including Windows, macOS, and Linux. It can
be used to build a wide range of applications, including web applications, desktop
applications, and microservices.

One of the key benefits of .NET Core is that it is modular, which means you can use
only the components you need for your application, making it more lightweight and
faster. Additionally, .NET Core includes many performance improvements over the
.NET Framework, including faster startup times and lower memory usage.

.NET Core is Free and Open Source.

The .NET Core platform is free and open source. .NET Core source code project is
available on GitHub. Any developer can get involved in .NET Core development.
Thousands of active developers participating in .NET Core development are
improving features, adding new features, and fixing bugs and issues.

An independent non-profit organization manages .NET Core called the .NET


Foundation. More than 60,000 developers and 3,700 companies are contributing to
the .NET ecosystem.

.NET Core is free and licensed under MIT and Apache licenses.

.NET Core is Cross-platform.

.NET Core supports and runs on Windows, macOS, and Linux operating systems. .NET
Core is consistent across architecture, including x64, x86, and ARM. The same
assemblies and libraries can be imported and used on multiple platforms. The
assemblies and libraries are built using one of the .NET languages, C#, VB.NET, or F#.

.NET Core is Sharable.


.NET Core uses one consistent API model written in .NET Standard that is common to
all .NET applications. The same API or library can be used with multiple platforms in
multiple languages.

.NET Core is Modern.

Unlike some older frameworks, .NET Core is designed to solve today's modern needs,
including being mobile friendly, build once run everywhere, scalable, and high
performance. .NET Core is designed to build applications that target all kinds of
devices, including IoTs and gaming consoles.

.NET supports modern language constructs with the help of C# version 8, like object-
oriented and modular programming, generics, collections, lambdas, Language
Integrated Query (LINQ), and asynchronous programming, which makes developers
productive. Learn more about C# 8 features here C# 8 Features.
Visual Studio 2019 and Visual Studio Code are the world's two most advanced and
modern developer IDEs. Both IDEs support modern needs and focus on cleanness,
speed, and productivity. Learn more about Visual Studio 2019 features here: Visual
Studio 2019 New Features.
.NET Core is Fast.

.NET Core 3.0 is fast. Compared to the .NET Framework and .NET Core 2.2 and
previous versions, .NET Core 3.0 is blazing fast. .NET Core is much quicker than other
server-side frameworks such as Java Servlet and Node.js.

According to a report published by TechEmpowers, .NET Core is much faster than


any other framework. TechEmpower benchmark compares Web application
frameworks for tasks such as database access for a single query, multiple queries,
fortunes, data updates, plaintext, and JSON serialization.

.NET Core is Lightweight.

.NET Core is lightweight. .NET Core can be included in your app or installed on a
server side-by-side user, machine-wide, or. In addition, the .NET Core can be
deployed in Docker containers.
.NET Core is Friendly.

.NET Core is compatible with .NET Framework, Xamarin, and Mono, via .NET
Standard. .NET Core also supports working with various popular Web frameworks
and libraries such as React, Angular, and JavaScript. TypeScript is one of the key
components of the .NET Core and Visual Studio ecosystem.

Differences between .Net Core and .Net Framework:

BASED ON .NET Core .NET Framework

Certain components of
.Net Core is an open source. the .Net Framework are
Open Source open source.

.NET Framework is
compatible with the
Works on the principle of “build
windows operating
once, run anywhere”. It is
system. Although, it was
compatible with various operating
developed to support
systems — Windows, Linux, and
software and
Mac OS as it is cross-platform.
applications on all
Cross-Platform operating systems.

.Net Framework is used


.Net Core does not support
for the development of
desktop application development
both desktop and web
and it rather focuses on the web,
applications as well as it
windows mobile, and windows
Application supports windows forms
store.
Models and WPF applications.

.NET Core is packaged and .NET Framework is


installed independently of the installed as a single
underlying operating system as it package for Windows
Installation is cross-platform. operating system.

.Net Framework does


.Net Core supports the not support the
development and implementation development and
Support for of micro-services and the user has implementation of
Micro-Services to create a REST API for its microservices but it
and REST implementation. supports the REST API
Services services.
BASED ON .NET Core .NET Framework

.Net Framework is less


effective in comparison
.NET Core offers high to .Net Core in terms of
performance and scalability. performance and
Performance scalability of
and Scalability applications.

.NET Framework is
.NET Core is compatible with
compatible only with the
various operating systems —
Windows operating
Windows, Linux, and Mac OS.
Compatibility system.

.NET Core is compatible with


open-source mobile application
platforms, i.e. Xamarin, through
.NET Framework does
the .NET Standard Library.
not support any
Developers use Xamarin’s tools to
framework for mobile
configure the mobile app for
application development.
specific mobile devices such as
Android iOS, Android, and Windows
Development phones.

All the libraries of .Net


.Net Core is shipped as a Framework are
Packaging and collection of Nugget packages. packaged and shipped
Shipping together.

Whenever the updated version of


.NET Core gets initiated; it is
In the case of .Net
updated instantly on one machine
Framework, when the
at a time, thereby getting updated
updated version is
in new directories/folders in the
released it is first
existing application without
deployed on the Internet
affecting it. Thus, .NET Core has a
Information Server only.
Deployment good and flexible deployment
Model model.

It does not support


It has support for microservices. creation and
Support microservices.

It has no support for WCF It has excellent support


WCF Services services. for WCF services.
BASED ON .NET Core .NET Framework

It also supports REST


Supports Rest APIs
Rest APIs Services.

.Net Framework is heavy


for Command Line
.NET Core provides light-weight
Interface and developers
editors and command-line tools for
prefer to work on the
all supported platforms.
lightweight Command
CLI Tools Line Interface.

Code access security


.NET Core does not have features
feature is present in
like Code Access Security.
Security .NET Framework.

Unit 2: .NET Standard Control

You might also like