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