0% found this document useful (0 votes)
9 views2 pages

Understanding SQL Indexes and Blazor Components

The document outlines key concepts related to SQL indexing, primary and foreign keys, and their roles in database management. It also discusses the Entity Framework for object-to-table mapping, encapsulation, and abstractions in programming, along with examples of using IEnumerable and React's useState for state management. Additionally, it covers Blazor component structure and re-rendering behavior based on events or parameter updates.

Uploaded by

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

Understanding SQL Indexes and Blazor Components

The document outlines key concepts related to SQL indexing, primary and foreign keys, and their roles in database management. It also discusses the Entity Framework for object-to-table mapping, encapsulation, and abstractions in programming, along with examples of using IEnumerable and React's useState for state management. Additionally, it covers Blazor component structure and re-rendering behavior based on events or parameter updates.

Uploaded by

Ludwig VanCover
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SQL Index

 Help speed up searches/queries


 CREATE INDEX = Duplicate; CREATE UNQIUE INDEX = Unique
o CREATE INDEX idx_name
o ON DB (Col, Col, Col);

Primary vs Foreign Key

 Primary Key – unique identifier for each record


 Foreign key – used to reference the primary key of a record in a
different table
o Users Table: UserID and Name
o Posts Table: Post ID, AuthorID, Content
 Allows for lookup of data from one table without needing to duplicate
that data in another

Entity Framework

 Maps objects in software to tables/columns in database

Encapsulation

 Combinibng data and functions into classes

Abstractions

 Showing only relevant data and hide details from user


 Public, Private

IEnumerable

 Exposes enumerator, which supports interaction over a non-generic


collection
 var letters = [Link]('a', 26). Select(n => (char)n);
o static void Main()
o {
o foreach (string fruit in GetFruits())
o {
o [Link](fruit);
o }
o }
o
o // This method returns an IEnumerable<string>
o static IEnumerable<string> GetFruits()
o {
o yield return "Apple";
o yield return "Banana";
o yield return "Orange";
o }

useState

 Import it
 const [age, setAge] = useState(28);
 function handleClick() {
o setAge(29);
 }
 Pass an updated function to update state (as age is not updated when
code already running)
o setAge(a => a + 1);

Component gets new props

 Generally triggers a re-render


 Hooks could cause a re-render

Blazor Component

 Components/[Link]
o Add content
 [Link] (<[Link] />
 /_imports.razor (@using [Link])

 In [Link]
 @page “/”
 <Name />

Blazor ReRender

 Event or updating parameters from a parent component

You might also like