discover, master, influenceslide 1 sql server compact edition and the entity framework rob sanders...

16
Discover, Master, Influence Slide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Upload: victor-pitts

Post on 23-Dec-2015

225 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence Slide 1

SQL Server Compact Edition and the Entity Framework

Rob SandersReadify

Page 2: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

INTRODUCTION

SQL Server Compact Edition and the Entity Framework

Slide 2

Page 3: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

The SQL Server Family

Slide 3

The SQL Server 2008 Family of Products• Enterprise• Standard• Workgroup• Web• Express

• Compact

Page 4: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Overview: SQL Server Compact Edition

• Relational Database• Part of the SQL Server Family• Runs on:

– Windows Mobile Operating Systems– Windows XP– Windows Server 2003– Windows Vista– Windows Server 2008

Slide 4

Page 5: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Why would I use Compact Edition?

Benefits:• Great for Disconnected Systems,• Lightweight - low footprint,• Support for T-SQL• Critical Business Reports?

Slide 5

Page 6: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Why would I use Compact Edition?

• Flat File based• Memory and CPU conscious design• Support for T-SQL, Encryption (but not Stored Procedures)• In-Process • Doesn’t Require a Service (unlike other SQL Server databases)• ODBC/ADO Supported• Also supported by the Sync Framework (SQL Server 2008)

Slide 6

Page 7: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

What’s new in Compact Edition 3.5?

• Synchronization (Sync Framework)• Better integration with SQL Management Studio & Visual Studio Server Explorer• Extended T-SQL support

– CROSS APPLY– CAST– TOP– Identity (Insert)

• Local Transaction Scope (On Desktops)• Unicode support• LINQ to SQL

Slide 7

Page 8: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Introducing the ADO.Net Entity Framework(EF)

• The goal of EF is to decrease the amount of code and maintenance required for data-oriented applications– Lets you create data access applications by programming against a

conceptual model instead of writing directly against a database schema

– Applications are freed from hard-coded dependencies on a particular data engine or storage schema.

– ADO.NET Data Services enables data to be exposed as a REST-based data service that can be consumed by Web clients.

• Entity Framework is central to Microsoft’s data access strategy for the .Net Framework

• Shipped with .Net Framework 3.5 Service Pack 1• Underpinned by LINQ to Entities

Slide 8

Page 9: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

The Entity Data Model

• The Entity Data Model is a Entity-Relationship data model which supports advanced features such as:– Abstract classes– Property / Entity renaming– Inheritance– Complex Types– Stored procedure mapping for insert, update and delete methods.– Mapping a single entity to multiple tables– Hiding join tables in collections– Documentation which populate Xml comments

Slide 9

Page 10: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Entity SQL

• Write queries independently of the data store with a more concise language– Provides a common query language across providers by extending the existing

SQL language with constructs to work with strong notions of type, inheritance, and relationships from the Entity Data Model

• SQL– SELECT sp.FirstName, sp.LastName, sp.HireDate

FROM SalesPerson spINNER JOIN Employee e ON sp.SalesPersonID = e.EmployeeIDINNER JOIN Contact c ON e.EmployeeID = c.ContactIDWHERE e.SalariedFlag = 1 AND e.HireDate >= '2006-01-01'

• Entity SQL– SELECT sp.FirstName, sp.LastName, sp.HireDate

FROM AdventureWorks.AdventureWorksDB.SalesPeople AS spWHERE e.HireDate >= '2006-01-01‘

• Only used for select statements

Slide 11

Page 11: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

PRACTICAL IMPLEMENTATION

SQL Server Compact Edition and the Entity Framework

Slide 13

Image: http://www.techpin.com

Page 12: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

How Compact Edition Works with the Entity Framework

Scope of the demonstration:

• Compact Edition integration with Server Explorer and SQL Server Management Studio

• Create a SQL Server Compact Edition Database• Query a Compact Edition database

Slide 14

Page 13: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

How Compact Edition Works with the Entity Framework

[Demo]

Slide 15

Page 14: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Further Reading

See the full presentation next month at SQL Code Camp in Wagga Wagga

October 11th and 12th 2008

References

Slide 16

Page 15: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Getting Started with Entity Framework

• Reading– MSDN Library Page

http://msdn.microsoft.com/en-us/library/bb399572.aspx– ADO.NET Team Blog

http://blogs.msdn.com/adonet– MSDN Forum

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=533&SiteID=1 • Resources

– Microsoft .NET Framework 3.5 Service Pack 1 http://www.microsoft.com/downloads/details.aspx?FamilyId=AB99342F-5D1A-413D-8319-81DA479AB0D7

– Microsoft Visual Studio 2008 Service Pack 1http://www.microsoft.com/downloads/details.aspx?familyid=FBEE1648-7106-44A7-9649-6D9F6D58056E

– eSqlBlasthttp://code.msdn.microsoft.com/esql.

Slide 17

Page 16: Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify

Discover, Master, Influence

Thank you

Rob SandersReadify

http://www.readify.net

http://www.twitter.com [Username @AusRob]http://rob.sanders.name [Personal Site]http://internationalized.spaces.live.com [Blog]

Slide 18