ORM/LINQ/SQL syntax Flashcards
What is ORM?
Object Relational Mapper
what do ORMs do?
ORMs maps data from DB to an object in your program
what are the two ways to connect your database to your code?
DB first and Code first
what is DB first?
The DB structure already exists, classes are created based on the existing structure
what is code first?
You create the DB structure based on the classes in the code
A _____ instance represents a session with the database and can be used to query and save instances of your entities
DBContext
Used to connect to your db
Connection String
The project that you build and run
Startup project
what is the syntax to create a migrations folder
dotnet ef migrations add -c –startup-project
a snapshot of the database schema given the current state of your models
Migration
what is the syntax to apply the changes of the latest migration to your database
dotnet ef database update
What does LINQ stand for?
Language-Integrated Query
a uniform query syntax in C# and VB.NET to retrieve data from different sources and formats. It is integrated in C# or VB, thereby eliminating the mismatch between programming languages and databases, as well as providing a single querying interface for different types of data sources.
LINQ
3 parts of a query operation:
Data Source
Query
Execution
Expressions that retrieve data from a data source
LINQ Queries
a set of instructions that describes what data to retrieve from a given data source (or sources) and what type and organization the returned data should have.
query
query expressed in query syntax
query expression
what clause starts a query expression
from
what clause ends a query expression
select or group
how many clauses can be in a query expression
one or more
what are some clauses?
where, orderby, join, let
what does the INTO keyword in a query expression do?
enable the result of a join or group clause to serve as the source for additional query clauses in the same query expression
From an application’s viewpoint, the specific type and structure of the original source data is not important
True
The application always sees the source data as an IEnumerable or IQueryable collection.
True