Upload
james-johnson
View
490
Download
0
Tags:
Embed Size (px)
DESCRIPTION
January 24, 2009 presentation to So Cal Code Camp at Cal State Fullerton - A real live web site with SQL Data Services.
Citation preview
A Real World Web Site with SQL Data ServicesSo Cal Code Camp January 24-25, 2009James JohnsonInland Empire .NET User’s [email protected]
About me
Founder and President, Inland Empire .NET User’s Group. Past 5 years in Riverside, San Bernardino Counties www.iedotnetug.org
Executive Director, Geeks Without Borders www.geeks-without-borders.org
My Blog www.duringlunch.com
Serial Netrepreneur Latringo.com, ElSalvadorArtwork.com, TourElSalvador.com,
0AAFFF.com, AzureBlueCoding, AnonymousTypes.com, etc. Last but not least
No bailar con monos borracho al comer su almuerzo.
More stuff
Have been developing software since i286 days Educational CD-ROMs If a mistake, had to redo the entire run Started looking at ways to have dynamic data Web development
Cold Fusion (yuck), PHP (yikes), ASP.NET (the promised land)
Met David Robinson on Code Trip (Feb 08) The rest is history
SQL Data Services - Introduction
Agenda
2. What is SDS
3. How to setup the development environment
SQL Data Services - Introduction
1. SDS is a component of SQL Services
2. Integrated into the “cloud”
3. Provides database and querying
4. Flexibility
5. Scaling
6. Developer agility
SQL Data Services - Introduction
SDS is built on SQL Server and Windows Server
2. Quickly build and extend applications
3. Low cost management with high scalability
4. Reliability, and security features
SDS – Setting up the environment
Download Azure Services Training Kit www.microsoft.com/azure/trainingkit.mspx Contains Hands-on-labs (HOLs) for:
Windows Azure .NET Services Live Services SQL Services
SDS – Setting up the environment
Sign up for the SDS Public CTP http://go.microsoft.com/fwlink/?LinkID=133905&clcid=0x409 Sign up is free, but will ask for CC for verification
Create a Solution Name and Password Name of solution is the username when logging into
system via code
SDS – Setting up the environment
SDS Developer Center http://msdn.microsoft.com/en-us/sqlserver/dataservices/default.aspx Link to change password for solution
SDS Primer http://msdn.microsoft.com/en-us/library/cc512417.aspx
Getting Started Forum http://social.msdn.microsoft.com/forums/en-
US/ssdsgetstarted/threads/
Authorities, Containers, Entities
Authorities, Containers and Entities, Oh My
2. SDS data model is based on this concept
3. Provides flexible schema
4. Easy to create data structures
Authorities, Containers, Entities
Authorities
2. Topmost level of the hierarchy anontypes-01
3. DNS name https://anontypes-01.data.database.windows.net/v1
Maps to specific data center Is a unit of geo-location
Authorities, Containers, Entities
Containers
2. Each container has unique id associated
3. Store the data contained in the application
4. Cannot be in a different geo-located Authority
5. Can contain homogeneous or heterogeneous data
Authorities, Containers, Entities
Entities
2. Actual bits of data stored in container
3. Stores any number of user-defined properties/values
4. Retrieved, added, updated, deleted
5. Partial updates are not supported
6. Entire entity is replaced in container when updated
Homogenous/Heterogeneous Data
Homogeneous data is similar to a database table, in which all entities are of the same kind
Books container stores “book” entities Highly structured applications should use
Heterogeneous data contains all types of entities MyOffice container stores “books”, “supplies”,
“furniture” Allows for querying across all entities in parent
container
Flexible Entities
1. Key concept of SDS
2. XML fragment with one element per property value.
3. Value restricted to simple scalar type of string String, binary, Boolean, decimal, datetime
4. Fixed metadata properties – Id, Version, Kind1. Version. New version assigned with each update
2. Kind. User-defined, identifying the entity type
Anonymous Types
A new podcasting website featuring the little known development geeks
Site runs on a hosted server Data is hosted on SQL Data Services Leads to differences in how we work with data When using REST, return types are XML Need to use LINQ
Differences to remember
An Entity is like a property bag – keys/values Each Entity in a Container can have a different
structure Different paradigm than when working with
database tables There is no “primary key”, instead an “EntityID”
User defined value
Containers
Can contain heterogeneous, homogeneous, or flexible entities
For this project decided to have four Containers at_page at_podcast at_podcastdata at_guest
Site structure
Administer text data Upload and administer BLOB’s (podcasts)
Demo only shows uploading – not streaming down
Standard ASP.NET Membership, Roles, Authentication for Admin pages
Classes for different aspects of site functions Pages, Podcasts, Guests, Configuration, Utilities
Using REST
POST (Insert, Create) PUT (Update) GET (Retrieve) DELETE (Delete)
Page Administration
Insert, Save, Edit, Delete Page code creates XML passed to the class Methods
SelectPages() SelectPage() InsertPage() UpdatePage() DeletePage()
Make sure to HtmlEncode strings going in HTML chars will mess things up with validity of the XML
Demo
Web site Page administration
Uploading PodCasts (BLOBs)
Uploading of BLOBs is possible, but can only send the object, no other data
Create two XML strings PodCast
EntityId, Container, FilePath
PodCastData Meta and other data about the PodCast EntityId,Title, RunTime, Guest, Publish Date, etc.
Since two different containers, can have same EntityId
Uploading PodCasts (BLOBs)
Two step process First insert the Meta data
Title, Guest, Description, etc.
If successful, upload the PodCast
Demo
Public facing side
One Master Page Navigation, PodCast List
One Content Page Page Content for different “pages”
Demo
Setting Navigation
Demo
Setting Page Content
Demo
Get All PodCasts Uses Join between Containers so that we can get
data back on the Guests as well
Demo
Get Single Uses Join between Containers Uses Where to get specific Pod Cast
Questions
Thank you
Email – [email protected] Inland Empire .NET User’s Group
www.iedotnetug.org 2nd Tuesday evenings of each month – Riverside
Geeks Without Borders www.geeks-without-borders.org
My Blog www.duringlunch.com
Please tip your wait staff PayPal address – [email protected]
Thanks to our sponsors
We could not hold these code camps for you without our sponsors.
These Guys ROCK!