LTI - round 2 Flashcards
SQL Joins
- Inner Join – returns rows with matching values on both tables
- Left/Right Join – returns all rows of either side and also matching values from other side
- Outer Join – returns all rows from both left and right side and puts nulls where there are no matches
- Cross Join – combination of all rows of both tables
- Self Join – joining self table
SQL Tables - migrating data
- SSMS tool (Export/Import Wizard) – takes care of exporting and importing process
- SQL script – queries to move data
- Backup/restore – create backup of db and restore it on next db server
Abstract class
- Blueprint for other classes
- Good for when you need a common base with some shared implementation among derived classes
- Allows for code reuse
Interface
- Good for when you know methods need to exist but you also know they may need to be implemented differently
- If you want to change the interface like adding new method / property to it, it will break all implementations
- Cannot have access modifiers
- Cannot have constructor
- Can only define methods
- You implement an interface (you inherit an abstract class)
- Composition
- Multiple unrelated classes can implement
- Allowing a class to implement multiple interfaces
Scoping
o Public – any class has access
o Protected – inherited class has access
o Private – only same class has access
* Interface – public
* Abstract class – private, protected, public
AutoMapper
Install by adding nuget package
Configure maps
Flattening/unflattening
Can handle mapping of lists/collections to other lists/collections
Can handle conditional mapping
* .ForMember(dest => dest.SomeProperty, opt => opt.Condition(src => src.SomeProperty != null));
Entity Framework
ORM (Object Relational Mapper) framework
* Makes it easier to work with databases using C# objects
* Abstracts away underlying database interactions
Key components
* DbContext – represents a session with the database
o Manages database connections, transactions
o Provides set of APIs for querying and interacting with data
* DbSet – represents a table
Provides a collection of entities
* Entities – represents objects that represent database records
o C# classes that represent objects in database
o Class properties == database columns
Best practices
* Managing lifespan of connection of DbContext
Authentication vs authorization
Authentication – verifying user login credentials
Authorization – verifying user permissions