Note
Note
NET Core
Models:- .NET development, the term "Models" typically refers to classes that
represent the data structure of your application. Models are used to define the
shape and behavior of your data entities, and they are commonly used in
conjunction with various frameworks and libraries, such as Entity Framework in
the case of database models or ASP.NET MVC for defining the structure of data
exchanged between the client and server.
Data Transfer Object:- A Data Transfer Object (DTO) is a design pattern used
to encapsulate and transfer data between different layers or components of a
software application. DTOs are simple, lightweight, and contain only the necessary
data fields required for a specific operation or communication between different
parts of an application. They serve as a container for data, allowing us to transport
information between various parts of our application without exposing the
underlying implementation details.
Why Use DTOs?
Reduced Overhead: DTOs allow us to send only the data needed for a particular
task, minimizing the amount of data transmitted over the network or passed
between application layers. This reduces the overhead associated with unnecessary
data transfer.
Data Transformation: DTOs provide a structured way to transform data from one
format to another, which is particularly useful when dealing with data received
from external sources or APIs.
DTO Mapping:- DTO (Data Transfer Object) mapping in the context of an API
involves the conversion between domain models or entities and DTOs. This
mapping is necessary when you want to expose a different structure of data through
your API than what is used internally in your application. AutoMapper is a popular
library in the .NET ecosystem that simplifies the process of mapping between
objects.
DataBase
SQL=>
Structured Query Language (SQL) is a standard programming language
for managing and manipulating relational databases. It primary consists
of a set of commands for performing various operations such as
querying data, updating data, inserting data, and deleting data from a
database.
SELECT: Retrieves data from one or more tables. The basic syntax is:
SELECT column1, column2, ...
FROM table_name
WHERE condition;
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
SELECT columns
FROM table1
JOIN table2 ON table1.column = table2.column;
GROUP BY: Groups rows that have the same values in specified
columns into summary rows, like "total" or "average."
Stored Procedure
A stored procedure is a precompiled collection of one or more SQL
statements that are stored on the database server. It is a named and saved
collection of SQL statements and procedural logic that can be reused and
shared by multiple programs or users. Stored procedures offer several
advantages, including improved performance, security, and code
reusability.
In this example:
In this example, @Num1 and @Num2 are input parameters, and @Sum
and @Product are output parameters. You can execute this stored
procedure and retrieve the results:
Entity Data Model (EDM): The Entity Data Model is a conceptual model that
represents the structure of data in a database. It includes entities, relationships, and
mapping information between the conceptual model and the actual database
schema.
Code-First: Developers can define the entity classes in code, and EF will generate
the database schema based on these classes.
Entity Framework Core: Entity Framework has evolved, and there is also a
lightweight and cross-platform version called Entity Framework Core, which is
designed to work with .NET Core and .NET 5 and later.
JWT:- JWT stands for JSON Web Token. It is a compact, URL-safe means of
representing claims to be transferred between two parties. These claims are
typically used to identify the user and provide additional information about them.
JWTs can be digitally signed, providing a way to verify the integrity and
authenticity of the information they contain.