discover, master, influenceslide 1 sql server compact edition and the entity framework rob sanders...
TRANSCRIPT
Discover, Master, Influence Slide 1
SQL Server Compact Edition and the Entity Framework
Rob SandersReadify
Discover, Master, Influence
INTRODUCTION
SQL Server Compact Edition and the Entity Framework
Slide 2
Discover, Master, Influence
The SQL Server Family
Slide 3
The SQL Server 2008 Family of Products• Enterprise• Standard• Workgroup• Web• Express
• Compact
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
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
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
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
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
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
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
Discover, Master, Influence
PRACTICAL IMPLEMENTATION
SQL Server Compact Edition and the Entity Framework
Slide 13
Image: http://www.techpin.com
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
Discover, Master, Influence
How Compact Edition Works with the Entity Framework
[Demo]
Slide 15
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
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
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