Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

11
Entity Framework Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig

Transcript of Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

Page 1: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

Entity FrameworkEntity Framework

MIS 324MIS 324

Professor SandvigProfessor Sandvig

Page 2: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

OutlineOutline

What is Entity FrameworkWhat is Entity Framework BenefitsBenefits DrawbacksDrawbacks ExampleExample

Page 3: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

What is Entity FrameworkWhat is Entity Framework

Microsoft’s newest data access Microsoft’s newest data access technologytechnology

Visual Studio:Visual Studio: Examines databaseExamines database Creates objects that represent data schemaCreates objects that represent data schema

LINQ (Language Integrated Query)LINQ (Language Integrated Query) Replaces SQLReplaces SQL Select, sort, filter, etc.Select, sort, filter, etc.

Page 4: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

BenefitsBenefits

Eliminates disconnect between code & Eliminates disconnect between code & databasedatabase No sql statements in codeNo sql statements in code

Use intellisense to write queryUse intellisense to write query LINQ works on all data collectionsLINQ works on all data collections

Arrays, lists, dataviews, etc.Arrays, lists, dataviews, etc.

Page 5: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

DrawbacksDrawbacks

Microsoft propriety technologyMicrosoft propriety technology LINQ query syntax different than SQLLINQ query syntax different than SQL

Better in many waysBetter in many ways Synchronization between database and Synchronization between database and

entity objects entity objects Change databaseChange database Rebuild entity objectsRebuild entity objects

Page 6: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

Creating ModelCreating Model

Page 7: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

Creating ModelCreating Model

Page 8: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

Creating ModelCreating Model

Page 9: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

Creating ModelCreating Model

Note: Relationships should be defined in database

Page 10: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

LinqLinq

Page 11: Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.

OutputOutput

Music Store ExampleMusic Store Example