A Real World Web Site with SQL Data Services So Cal Code Camp January 24-25, 2009 James Johnson Inland Empire .NET User’s Group [email_address] www.iedotnetug.org
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 What is SDS How to setup the development environment
SQL Data Services - Introduction SDS is a component of SQL Services Integrated into the “cloud” Provides database and querying Flexibility Scaling Developer agility
SQL Data Services - Introduction SDS is built on SQL Server and Windows Server Quickly build and extend applications Low cost management with high scalability 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 SDS data model is based on this concept Provides flexible schema Easy to create data structures
Authorities, Containers, Entities Authorities Topmost level of the hierarchy anontypes-01 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 Each container has unique id associated Store the data contained in the application Cannot be in a different geo-located Authority Can contain homogeneous or heterogeneous data
Authorities, Containers, Entities Entities Actual bits of data stored in container Stores any number of user-defined properties/values Retrieved, added, updated, deleted Partial updates are not supported 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 Key concept of SDS XML fragment with one element per property value. Value restricted to simple scalar type of string String, binary, Boolean, decimal, datetime Fixed metadata properties – Id, Version, Kind Version. New version assigned with each update 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_address] Inland Empire .NET User’s Group www.iedotnetug.org 2 nd  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 – members@iedotnetug.org
Thanks to our sponsors We could not hold these code camps for you without our sponsors.  These Guys ROCK!

Sql Data Services

  • 1.
    A Real WorldWeb Site with SQL Data Services So Cal Code Camp January 24-25, 2009 James Johnson Inland Empire .NET User’s Group [email_address] www.iedotnetug.org
  • 2.
    About me Founderand 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.
  • 3.
    More stuff Havebeen 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
  • 4.
    SQL Data Services- Introduction Agenda What is SDS How to setup the development environment
  • 5.
    SQL Data Services- Introduction SDS is a component of SQL Services Integrated into the “cloud” Provides database and querying Flexibility Scaling Developer agility
  • 6.
    SQL Data Services- Introduction SDS is built on SQL Server and Windows Server Quickly build and extend applications Low cost management with high scalability Reliability, and security features
  • 7.
    SDS – Settingup 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
  • 8.
    SDS – Settingup 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
  • 9.
    SDS – Settingup 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/
  • 10.
    Authorities, Containers, EntitiesAuthorities, Containers and Entities, Oh My SDS data model is based on this concept Provides flexible schema Easy to create data structures
  • 11.
    Authorities, Containers, EntitiesAuthorities Topmost level of the hierarchy anontypes-01 DNS name https://anontypes-01.data.database.windows.net/v1 Maps to specific data center Is a unit of geo-location
  • 12.
    Authorities, Containers, EntitiesContainers Each container has unique id associated Store the data contained in the application Cannot be in a different geo-located Authority Can contain homogeneous or heterogeneous data
  • 13.
    Authorities, Containers, EntitiesEntities Actual bits of data stored in container Stores any number of user-defined properties/values Retrieved, added, updated, deleted Partial updates are not supported Entire entity is replaced in container when updated
  • 14.
    Homogenous/Heterogeneous Data Homogeneousdata 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
  • 15.
    Flexible Entities Keyconcept of SDS XML fragment with one element per property value. Value restricted to simple scalar type of string String, binary, Boolean, decimal, datetime Fixed metadata properties – Id, Version, Kind Version. New version assigned with each update Kind. User-defined, identifying the entity type
  • 16.
    Anonymous Types Anew 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
  • 17.
    Differences to rememberAn 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
  • 18.
    Containers Can containheterogeneous, homogeneous, or flexible entities For this project decided to have four Containers at_page at_podcast at_podcastdata at_guest
  • 19.
    Site structure Administertext 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
  • 20.
    Using REST POST(Insert, Create) PUT (Update) GET (Retrieve) DELETE (Delete)
  • 21.
    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
  • 22.
    Demo Web sitePage administration
  • 23.
    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
  • 24.
    Uploading PodCasts (BLOBs)Two step process First insert the Meta data Title, Guest, Description, etc. If successful, upload the PodCast
  • 25.
  • 26.
    Public facing sideOne Master Page Navigation, PodCast List One Content Page Page Content for different “pages”
  • 27.
  • 28.
  • 29.
    Demo Get AllPodCasts Uses Join between Containers so that we can get data back on the Guests as well
  • 30.
    Demo Get SingleUses Join between Containers Uses Where to get specific Pod Cast
  • 31.
  • 32.
    Thank you Email– [email_address] Inland Empire .NET User’s Group www.iedotnetug.org 2 nd 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]
  • 33.
    Thanks to oursponsors We could not hold these code camps for you without our sponsors. These Guys ROCK!