Microsoft

Blog Categories

Subscribe to RSS feed

Archives

Chris Woodruff

Twitter cwoodruff

Posts by this author: RSS

Congratulations to Perficient’s Jason Follas, Microsoft MVP of the Year

follas

Every year, Microsoft awards a group of Developer MVPs with an additional recognition. It has become a tradition to recognize those MVPs who have demonstrated exceptional community effort by inviting them to a special dinner during the yearly MVP Summit event located at the Redmond headquarters. Technical Fellows Anders Hejlsberg and Brian Harry were hosts to this year’s event which celebrated 29 community leaders during the Developer MVP Recognition Dinner. This year, our own Jason Follas was awarded with this special recognition for his effort and dedication to the technical community in Microsoft’s Heartland District and beyond.

The MVPs recognized were selected through a selection processed handled by key Microsoft employees and more importantly, Jason’s peers in the MVP community. Jason is a dedicated community member who gives a lot of time and energy to user groups and technical conferences; he is one of the organizers behind the Day of .NET in Ann Arbor, in addition to CodeMash. Jason is also a leader for the Northwest Ohio .NET User Group in Toledo and is currently an Architect in the Detroit LBU. Congratulations Jason!

The Biggest Week in Microsoft History

new-microsoft-logo-largeI have had a few days to recover from the last 10 days of launches, releases, announcements and presentations from Microsoft and after catching up from the sleep deprivation, I have had an epiphany. Everything you knew about Microsoft has not changed but everything you knew about Microsoft has been turned upside-down.

First let’s look at the launches from the last 10 days. We start in NYC on October 26 before Hurricane Sandy ravaged the city and the entire east coast of the US. On this date, the Windows 8 and Microsoft first computer device for Windows RT, the Surface was released. A little background about Windows RT which is a version of Windows for the ARM processor. It looks like Windows 8 but it slightly different. Windows RT does not have support for x86 applications so those apps you install will not work or be supported. What do you get with Windows RT is an OS that works on cheaper more efficient hardware so battery life is much better without losing performance. The Surface device is Microsoft’s first mobile computing entry and is a good device for people that want the portability of a tablet while keeping the productivity of a laptop. It has most of the Office applications we use (sans Outlook) so you can do your work after using the apps like Netflix, Kindle and Angry Bird Space. NYC was a buzz with the launch and Time Square was packed with people. Great to see this type of excitement about a Microsoft product.

Next we hop a flight to the other coast and experience the next Microsoft launch. On October 29, Microsoft launched Windows Phone 8 with Joe Belfiore leading the keynote. Windows Phone 8 is the next version of the smartphone OS and a great sequel to Windows Phone 7. What are the benefits and drawbacks of Windows Phone 8? The new phones for the mobile OS will have better HD screens, more powerful processors and will give users more features in their phones (another blog post about Windows Phone 8 features coming soon). The downside is that if you have a Windows Phone 7 device, you will not be able to upgrade to Windows Phone 8. Microsoft has built Windows Phone 8 to match the kernel of Windows 8. The new mobile OS should make a huge splash in the market with its matching UX shared with Windows 8.

What better way to follow up with the Windows 8, Surface and Windows Phone 8 launches then a deep dive and celebration from Microsoft? That is just what happened last week starting on October 28 when Microsoft hosted thousands of developers on their main campus in Redmond, WA for BUILD. This was the second year Microsoft held this event and the first on campus. There were some logistical issues along the way with buses, crowded sessions that got moved minutes before they were to start so that more people could attend (I termed Agile Scheduling for this process) and finally, the typical Seattle rain made its debut. As part of the planning, one of the biggest tents ever constructed, was put up to house the keynotes and Beer Fest celebration for attendees. The tent seemed to have it own atmosphere and a few of joked that maybe it could be used on Mars when colonization started. In the end, I think everyone had a great time and it was enjoyable to be in the buzz and experience the space where Microsoft employees get to work and play every day.

The keynotes for BUILD were also a sign of things to come. Steve Ballmer kicked things off and did most of the demos during the first day of the BUILD keynotes solo. It was a daring and exciting move for the Microsoft CEO to not only sit up on stage with so many Windows 8 and RT devices but he actually used his personal Microsoft account to demo the features and capabilities of the next flagship OS from Microsoft. I was surprised at the passion and enthusiasm Ballmer had while demoing and it really got the crowd going. He even joked around a little and made fun of himself which you always like to see from the CEO of such a large company. In addition to a great keynote, Microsoft also announced that each attendee to BUILD would receive 100Gb of SkyDrive space, a 32Gb Surface and a Nokia Lumia 920 developer phone (unlocked and build for most carrier SIM cards).

The second day of BUILD started with keynotes from the services side of the Windows 8… the other huge bet Microsoft has made in the last 4 years: Windows Azure. The highlight of the keynote was the announcement that Windows Azure Mobile Services would be opened up for use in Windows Phone 8. That along with other new features and updates to Azure for web developers and IT Pros made this keynote stand out. Nothing as exciting as the first day but still a great message.

Throughout BUILD there were many great sessions but the best part I experienced was meeting with friends and Microsoft employees to discuss what they have been doing, where they see the future headed with Microsoft and also, just making sure we all had laughs and a few drinks in the evenings over great conversations.

Do I have high hopes for the future of Windows and the developer path at Microsoft? I do, but with some reservations. I know this business is not won on technology alone. Microsoft has to do a better job marketing Windows and Windows Phone for the consumers to recognize it as the best product. They must also refresh the Surface line quickly to keep up with the competition. Will they stay the course? Time will tell but I think after spending one of the greatest weeks at Microsoft, things definitely feel different.

Thanks Microsoft for the Visual C# MVP Award

MVP_BlueOnlySmallI was awarded for the 5th year (not concurrent with a 3 month gap between the first and second years) as a Microsoft MVP. I was moved from the Data Platform Development group to Visual C# and could not be more happy about the move. I have a lot of friends both in the C# MVP group as well as in Microsoft on the language and Visual Studio teams. Looking forward to working with these great people for the next year and beyond.

It has been a great journey so far being on my 3rd MVP group: SQL then Data Platform and now C#. I want to thanks everyone in the community that listen to the Deep Fried Bytes podcast, read my blog, attended my presentations and finally follow me on twitter and other social media networks.

I’m speaking at Cloud & Virtualization Live!, Dec. 10-14 in Orlando – will you be there?

I’ll be speaking at a brand new cloud & virtualization conference for IT professionals, systems administrators, developers and consultants – Cloud & Virtualization Live!, December 10-14 in Orlando, FL. http://bit.ly/CVSPEAK25

I’ll be presenting the following sessions:

· Developing Mobile Solutions with Azure and Windows Phone

· Pushing Data to and from the Cloud with SQL Azure Data Sync

This event will have something for everyone, and will provide intelligent training on the real-world applicability of today’s cloud and virtualization technologies.  Across 5 days, attendees will develop their skill sets in evaluating, deploying and optimizing cloud and virtual-based environments.

SPECIAL OFFER: As a speaker, I can extend $500 savings on the 5-day package. Register here: http://bit.ly/CVSPK25Reg  and use code CVSPK25.

The extra-cool part about Cloud & Virtualization Live!: four events in one! This year, the event will be co-located with SQL Server Live!, SharePoint Live!, and Visual Studio Live!. You can customize your conference agenda and attend ANY sessions from all four events. Register now: http://bit.ly/CVSPK25Reg

Chris Woodruff will be speaking at ThatConference 8/13-15/2012

That ConferenceI am taking some time off this summer to spend time with my family and do some writing. My return to the community will happen in August at the Kalahari Resort in the Wisconsin Dells for the first ThatConference conference. I am very excited because I am speaking on some great topics and looking forward to seeing old friends and making some new ones.

I am also going to be bringing the podcasting equipment and doing some interviews for Deep Fried Bytes. If you will be there and want to chat about something let me know before the event.

Even though my family is coming to enjoy the waterpark with me for the conference I am still bringing some West Michigan brews from the best brewery in the world Founders Brewery. I do not know what 2 beers I will bring and need to know so I can order the kegs before traveling. Please help me decide by selecting 2 from the poll on my personal blog.

** Please go to my personal blog to vote for the beers of you will be attending ThatConference.

Here are the two sessions I will be doing on Tuesday and Wednesday of the conference.

The Top 10 Reasons You Need to Learn about Data in Your Windows Phone 7 Mango App

You know you have to have a great experience when you develop your Windows Phone 7 applications right? The greatest skill to give your users that experience is data. There are ways to improve your Windows Phone 7 Mango application and Chris Woodruff will teach you how to get data quickly, save it with validation, save it locally and many, many more tricks. Come see why you should know the tricks of the trade before developing that killer Windows Phone 7 Mango app. You will be a Data Experience expert when you leave the room after this session.

Why Windows 8 Metro Styles Applications need OData and How You can be a Data Ninja

Windows 8 Metro applications are the ultimate in consumer experience but what drives these applications? Data!! What you need to remember about Windows 8 Metro applications is that they can work with data through web services. What is the easiest way to drive your new Metro applications and make your users happy? OData is the answer and Chris Woodruff will teach you the secrets of OData and how these skills will make you a Master of Data.

Chris Woodruff Speaking at Code PaLOUsa 2012 Conference

Perficient’s National Microsoft Cloud Practice Lead Chris Woodruff will be speaking at this week’s Code PaLOUsa 2012 Conference in Louisville, KY covering the Open Data Protocol (OData) during a Pre-Conference workshop Thursday and 2 OData presentations Friday and Saturday. Tickets are still available at the conference home page.

Here is the list of Chris’ workshop and presentations:

31 Days Of OData – Day 5 Addressing Entities In OData

Before we can learn about Addressing Entities in OData, we have to lay the ground work for all OData commanding including queries. We will first detail and demonstrate the Uniform Resource Identifier or URI and then look at a URI for OData.

What is a URI?

An URI is a string that is used to identify a name(URN) or a location to a resource( URL). The URN works like a name of a person or a business name where the URL functions like the physical address of a person or business.

The following are two examples of URI’s

http://services.odata.org/OData/OData.svc

http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name

As you can the two URI’s are both OData URI’s. The first is called the Service Root URI and the second is an OData query URI that us requesting the first two Products that are associated to Category 1 returned in alphabetical order.

Service Root URI

Every OData call must include the Service Root URI to interact with an OData feed. Think of the Service Root URI as the location of the OData feed. It represents the HTTP listener that will do the work on the behalf of the consumer of the OData feed based on the URI past the root and the HTTP Verb or Command sent.

You may discover that some OData Service Root URI’s do not end with svc. This can be accomplished with routing the request as shown in Ron Jacob’s blob post here.

Resource Path of the OData URI

The Resource Path of OData request URI functions as the resource locator from the OData consumer. It can be a request to any of the following resources of the OData protocol:

  • Single Entity (Baseball Player)
  • Collection of Entities (Baseball Players from a team and year)
  • Entity relationship between multiple Entities (Batting Statistics for a specific Baseball Player)
  • A Property of an Entity (Last Name of a Baseball Player)
  • Service Operation
  • Other resources

Query Options of the OData URI

We will work through many of the Query options during this blog series. Know that all Query Options in OData request URI’s specify three types of information:

  • System Query Options – we will explore this type in detail during this series.
  • Custom Query Options – extension point for server specific information. The Custom Query Option is always passed as a name/value pair.
  • Service Operation Parameters – used to reference a call Service Operations that reside on the OData feed.

Querying Entities

Addressing single or collections of entities located in an OData feed is akin to the FROM clause of a SQL SELECT statement along with JOINs. By allowing associations between Entities an OData request URI can reach far and wide inside the OData feed to request any shape and collection of data.

The following grammar are the rules that cover all entity query scenarios: single Entity, collection of Entities or single Property of Entity.

The areas of the OData request

Details
Collection The Collection will cover either a requested Collection of Entities or from a Service Collection which returns a Collection of Entities.
KeyPredicate A predicate that identifies the value(s) of the key Properties of an Entry. If the Entry has a single key Property the predicate may include only the value of the key Property. If the key is made up of two or more Properties, then its value must be stated using name/value pairs. More precisely, the syntax for a KeyPredicate is shown by the following figure. 

NavPropSingle The name of a Navigation Property defined by the Entry associated with the prior path segment. The Navigation Property must identify a single entity (that is, have a “to 1″ relationship).
NavPropCollection Same as NavPropSingle except it must identify a Collection of Entries (that is, have a “to many” relationship).
ComplexType The name of a declared or dynamic Property of the Entry or Complex Type associated with the prior path segment.
Property The name of a declared or dynamic Property of the Entry or Complex Type associated with the prior path segment.

 

We will be looking at many ways to query and shape the data returned from an OData feed in future blog posts. Stay tuned and hope you are enjoying the series. I am working to catch up also.

31 Days of OData – Day 4 Metadata in OData

OData-logo_bigger_thumb1Let’s go back 15 years ago when I started professionally developing software and using relational databases. The relational database was a great tool to deal with data. No more did we have to use flat files to store our data with tools named Paradox, dBase and other such data management systems. We now had more flexibility to build our solutions and the new architecture pattern Client-Server that was the rage for all developers circa 1996.

Relational databases gave us the SQL language and that in turn allowed the developers of the day to quickly create, read, update and delete (CRUD) data that was stored on the server and build our applications at the client. Life was great (for me at least) because I knew nothing different. If I wanted to learn about a new database, I would get the schema either in a text file that had a set of CREATE SQL calls for all the objects that made up the database. If we were really lucky we received a printed graph of the database that gave the developers a nice graphical layout of the data tables and views with the relationships between the tables and views. It took time to understand the meaning of the database but that is what we did.

In 2007 I experienced a glimpse into the future that shook my world. It was when I started experimenting with a new incubation project from Microsoft called Astoria. I saw it at first as way to get data across HTTP and that excited me. What blew my mind after really learning about it was Metadata. Compared to the time I spent discovering the meaning and shape of the data schema of a relational database that a DBA created and handed to me, Metadata was the bridge into a new frontier.

Let’s step back and take a look at what Metadata is and how it works within OData. Metadata is defined broadly as “Data about Data”. Think of metadata as the Dewey Decimal we learned as kids when we visited the library. The card catalog does not carry the information about the content inside the books but it does describe the books and information that the books contain in a broad level to allow readers to find and locate the books they are interested in on the shelves. Metadata does the same for us as users of the data that the OData feeds allow us to consume.

In OData, the Service Metadata Document allows the consumers of the data provided by the OData feed to understand the Entity Data Model (Day 3 of the series). The Service Metadata Document does not carry any details of the data held within the data repository of the OData feed. It contains the roadmap to the data. In the SOAP world the Service Metadata Document would be the equivalent of the WSDL file. Let’s look at the structure of the Service Metadata Document (in XML) and walk through its map. We will use the Baseball Statistics OData feed found here as our example.

We first need to query the Service Metadata Document from the OData feed. How this is accomplished is my using the $metadata query option at the base of the OData feed as shown below:

http://baseball-stats.info/OData/baseballstats.svc/$metadata

The Service Metadata Document is returned in the payload after the $metadata query and has three parts: the EDMX which is made up of the OData Model and also the Entity Collection.

Code Snippet
  1. <?xmlversion=1.0encoding=UTF8standalone=true?>
  2. <edmx:Edmxxmlns:edmx=http://schemas.microsoft.com/ado/2007/06/edmxVersion=1.0>
  3. <edmx:DataServicesm:DataServiceVersion=1.0xmlns:m=http://schemas.microsoft.com/ado/2007/08/dataservices/metadata>
  4. <Schemaxmlns=http://schemas.microsoft.com/ado/2008/09/edmxmlns:d=http://schemas.microsoft.com/ado/2007/08/dataservicesxmlns:m=http://schemas.microsoft.com/ado/2007/08/dataservices/metadataNamespace=BaseballStatsModel>
  5. <EntityTypeName=Allstar>
  6. <Key>
  7. <PropertyRefName=playerID/>
  8. <PropertyRefName=yearID/>
  9. <PropertyRefName=lgID/>
  10. </Key>
  11. <PropertyName=playerIDFixedLength=falseUnicode=trueMaxLength=10Nullable=falseType=Edm.String/>
  12. <PropertyName=yearIDNullable=falseType=Edm.Int16/> <PropertyName=lgIDFixedLength=falseUnicode=trueMaxLength=2Nullable=falseType=Edm.String/>
  13. <NavigationPropertyName=PlayerToRole=PlayerFromRole=AllstarRelationship=BaseballStatsModel.FK_Allstar_Player/>
  14. </EntityType>
  15. <EntityTypeName=AllstarFull>
  16. <Key>
  17. <PropertyRefName=playerID/>
  18. <PropertyRefName=yearID/>
  19. <PropertyRefName=gameNum/>
  20. </Key>
  21. <PropertyName=playerIDFixedLength=falseUnicode=trueMaxLength=10Nullable=falseType=Edm.String/>
  22. <PropertyName=yearIDNullable=falseType=Edm.Int16/> <PropertyName=gameNumNullable=falseType=Edm.Int16/>
  23. <PropertyName=gameIDFixedLength=falseUnicode=trueMaxLength=12Nullable=trueType=Edm.String/>
  24. <PropertyName=teamIDFixedLength=falseUnicode=trueMaxLength=3Nullable=trueType=Edm.String/>
  25. <PropertyName=lgIDFixedLength=falseUnicode=trueMaxLength=2Nullable=trueType=Edm.String/>
  26. <PropertyName=GPNullable=trueType=Edm.Int16/> <PropertyName=startingPosNullable=trueType=Edm.Int16/>
  27. <NavigationPropertyName=PlayerToRole=PlayerFromRole=AllstarFullRelationship=BaseballStatsModel.FK_AllstarFull_Player/>
  28. </EntityType>
  29. <EntityTypeName=PitchingTotals>
  30. <Key>
  31. <PropertyRefName=playerID/>
  32. </Key>
  33. <PropertyName=playerIDFixedLength=falseUnicode=trueMaxLength=10Nullable=falseType=Edm.String/>
  34. <PropertyName=WNullable=trueType=Edm.Int32/> <PropertyName=LNullable=trueType=Edm.Int32/>
  35. <PropertyName=GNullable=trueType=Edm.Int32/> <PropertyName=GSNullable=trueType=Edm.Int32/>
  36. <PropertyName=CGNullable=trueType=Edm.Int32/> <PropertyName=SHONullable=trueType=Edm.Int32/>
  37. <PropertyName=SVNullable=trueType=Edm.Int32/> <PropertyName=IPoutsNullable=trueType=Edm.Int32/>
  38. <PropertyName=HNullable=trueType=Edm.Int32/> <PropertyName=ERNullable=trueType=Edm.Int32/>
  39. <PropertyName=HRNullable=trueType=Edm.Int32/> <PropertyName=BBNullable=trueType=Edm.Int32/>
  40. <PropertyName=SONullable=trueType=Edm.Int32/> <PropertyName=BAOppNullable=trueType=Edm.Double/>
  41. <PropertyName=IBBNullable=trueType=Edm.Int32/> <PropertyName=WPNullable=trueType=Edm.Int32/>
  42. <PropertyName=HBPNullable=trueType=Edm.Int32/> <PropertyName=BKNullable=trueType=Edm.Int32/>
  43. <PropertyName=BFPNullable=trueType=Edm.Int32/> <PropertyName=GFNullable=trueType=Edm.Int32/>
  44. <PropertyName=RNullable=trueType=Edm.Int32/> <PropertyName=SHNullable=trueType=Edm.Int32/>
  45. <PropertyName=SFNullable=trueType=Edm.Int32/> <PropertyName=GIDPNullable=trueType=Edm.Int32/>
  46. </EntityType>
  47. <AssociationName=FK_Allstar_Player>
  48. <EndType=BaseballStatsModel.PlayerMultiplicity=1Role=Player/> <EndType=BaseballStatsModel.AllstarMultiplicity=*Role=Allstar/> <ReferentialConstraint>
  49. <PrincipalRole=Player>
  50. <PropertyRefName=playerID/>
  51. </Principal> <DependentRole=Allstar>
  52. <PropertyRefName=playerID/>
  53. </Dependent>
  54. </ReferentialConstraint>
  55. </Association>
  56. <AssociationName=FK_AllstarFull_Player>
  57. <EndType=BaseballStatsModel.PlayerMultiplicity=1Role=Player/> <EndType=BaseballStatsModel.AllstarFullMultiplicity=*Role=AllstarFull/> <ReferentialConstraint>
  58. <PrincipalRole=Player>
  59. <PropertyRefName=playerID/>
  60. </Principal> <DependentRole=AllstarFull>
  61. <PropertyRefName=playerID/>
  62. </Dependent>
  63. </ReferentialConstraint>
  64. </Association>
  65. <AssociationName=FK_TeamsHalf_Teams>
  66. <EndType=BaseballStatsModel.TeamMultiplicity=1Role=Team/> <EndType=BaseballStatsModel.TeamHalfMultiplicity=*Role=TeamHalf/> <ReferentialConstraint>
  67. <PrincipalRole=Team>
  68. <PropertyRefName=yearID/>
  69. <PropertyRefName=lgID/>
  70. <PropertyRefName=teamID/>
  71. </Principal> <DependentRole=TeamHalf>
  72. <PropertyRefName=yearID/>
  73. <PropertyRefName=lgID/>
  74. <PropertyRefName=teamID/>
  75. </Dependent>
  76. </ReferentialConstraint>
  77. </Association>
  78. </Schema>
  79. <Schemaxmlns=http://schemas.microsoft.com/ado/2008/09/edmxmlns:d=http://schemas.microsoft.com/ado/2007/08/dataservicesxmlns:m=http://schemas.microsoft.com/ado/2007/08/dataservices/metadataNamespace=BaseballStatsOData>
  80. <EntityContainerName=BaseballStatsEntitiesxmlns:p7=http://schemas.microsoft.com/ado/2009/02/edm/annotationm:IsDefaultEntityContainer=truep7:LazyLoadingEnabled=true>
  81. <EntitySetName=AllstarEntityType=BaseballStatsModel.Allstar/>
  82. <EntitySetName=AllstarFullEntityType=BaseballStatsModel.AllstarFull/>
  83. <EntitySetName=PitchingTotalsEntityType=BaseballStatsModel.PitchingTotals/>
  84. <AssociationSetName=FK_Allstar_PlayerAssociation=BaseballStatsModel.FK_Allstar_Player>
  85. <EndRole=PlayerEntitySet=Player/>
  86. <EndRole=AllstarEntitySet=Allstar/>
  87. </AssociationSet>
  88. <AssociationSetName=FK_AllstarFull_PlayerAssociation=BaseballStatsModel.FK_AllstarFull_Player>
  89. <EndRole=PlayerEntitySet=Player/>
  90. <EndRole=AllstarFullEntitySet=AllstarFull/>
  91. </AssociationSet>
  92. <AssociationSetName=FK_TeamsHalf_TeamsAssociation=BaseballStatsModel.FK_TeamsHalf_Teams>
  93. <EndRole=TeamEntitySet=Team/>
  94. <EndRole=TeamHalfEntitySet=TeamHalf/>
  95. </AssociationSet>
  96. </EntityContainer>
  97. </Schema>
  98. </edmx:DataServices>
  99. </edmx:Edmx>

OData Model

(more…)

31 Days of OData – Day 3 OData Entity Data Model

OData-logo_biggerFrom Day 2 of the series, we looked at data types that are present in the OData protocol. These data types allow for the richness of the data experience. Next we will look at taking these data types and crafting the entities that make up the OData feed.

An OData feed is very much like a database with tables, foreign keys and stored procedures. The data from an OData feed does not have to originate in a relational database but this is the first and most important type of data repository that OData can represent. The OData’s Entity Data Model (EDM) is simple but elegant in its representation of the data. It is designed to handle the data but also the relationships between entities that allow for the rich data experience we experience.

The Roadmap of the EDM

Just like a roadmap the EDM acts as a guide that allows us to travel the OData feed’s paths. It furnishes us the collections of entities and all details needed to understand the entities within its map. The EDM also gives us the paths or associations between the unique Entities of the OData feed. The ability to navigate easily without knowing much about the layout of the OData land is where OData gives us the freedom to have the Data Experiences (DX) we need for today’s solutions and consumer expectations.

The Entitles in an OData feed represents a specific type of data or Entity Type. The Entity Types of an OData feed could simulate some real world item, concept or idea such as a Book, College Course or Business Plan. The Entity Type contains properties that must adhere to the data types allowed and provided by the OData protocol or be of a Complex Type (explained later). To exist in the OData protocol, the Entity Type must be unique and so must have a unique identifier that allow for the Entities of that Entity Type to be located and used within the OData Feed. The Entity Key can be composed of one or more Entity properties and will be a unique property for the Entity Type. Most Entity Types will have a single property but that is not a requirement. An example of a multiple property Entity Type key is on my baseball stats OData feed and the Batting Entity Type.


The Batting Entity Type in my baseball stats OData feed is comprised of the following properties:

  • playerID – the Player Entity Type’s Key
  • yearID – the year of the baseball season
  • stint – baseball players could be traded and traded back to a team in the same season so needs to be tracked
  • teamID – the team the Player played for in the stint
  • lgID – the league of the team the player played for in the stint

As you can see OData can handle complex or composite Keys and allow for almost anything we give it. The collection of Entities is grouped in an Entity Set within the OData feed.

The following is an example of an Entity Type from the baseball statistics OData feed.

<EntityType Name="Player"> <Key> <PropertyRef Name="playerID"/> </Key> <Property Name="playerID" FixedLength="false" Unicode="true" MaxLength="10" Nullable="false" Type="Edm.String"/> <Property Name="hofID" FixedLength="false" Unicode="true" MaxLength="10" Nullable="true" Type="Edm.String"/> <Property Name="birthYear" Nullable="true" Type="Edm.Int16"/> <Property Name="birthMonth" Nullable="true" Type="Edm.Int16"/> <Property Name="birthDay" Nullable="true" Type="Edm.Int16"/> <Property Name="birthCountry" FixedLength="false" Unicode="true" MaxLength="50" Nullable="true" Type="Edm.String"/> <Property Name="birthState" FixedLength="false" Unicode="true" MaxLength="2" Nullable="true" Type="Edm.String"/> <Property Name="birthCity" FixedLength="false" Unicode="true" MaxLength="50" Nullable="true" Type="Edm.String"/> <Property Name="deathYear" Nullable="true" Type="Edm.Int16"/> <Property Name="deathMonth" Nullable="true" Type="Edm.Int16"/> <Property Name="deathDay" Nullable="true" Type="Edm.Int16"/> <Property Name="deathCountry" FixedLength="false" Unicode="true" MaxLength="50" Nullable="true" Type="Edm.String"/> <Property Name="deathState" FixedLength="false" Unicode="true" MaxLength="2" Nullable="true" Type="Edm.String"/> <Property Name="deathCity" FixedLength="false" Unicode="true" MaxLength="50" Nullable="true" Type="Edm.String"/> <Property Name="nameFirst" FixedLength="false" Unicode="true" MaxLength="50" Nullable="true" Type="Edm.String"/> <Property Name="nameLast" FixedLength="false" Unicode="true" MaxLength="50" Nullable="true" Type="Edm.String"/> <Property Name="nameNote" FixedLength="false" Unicode="true" MaxLength="255" Nullable="true" Type="Edm.String"/> <Property Name="nameGiven" FixedLength="false" Unicode="true" MaxLength="255" Nullable="true" Type="Edm.String"/> <Property Name="nameNick" FixedLength="false" Unicode="true" MaxLength="255" Nullable="true" Type="Edm.String"/> <Property Name="weight" Nullable="true" Type="Edm.Int16"/> <Property Name="height" Nullable="true" Type="Edm.Double"/> <Property Name="bats" FixedLength="false" Unicode="true" MaxLength="1" Nullable="true" Type="Edm.String"/> <Property Name="throws" FixedLength="false" Unicode="true" MaxLength="1" Nullable="true" Type="Edm.String"/> <Property Name="debut" Nullable="true" Type="Edm.DateTime"/> <Property Name="finalGame" Nullable="true" Type="Edm.DateTime"/> <Property Name="college" FixedLength="false" Unicode="true" MaxLength="50" Nullable="true" Type="Edm.String"/> <NavigationProperty Name="Allstar" ToRole="Allstar" FromRole="Player" Relationship="BaseballStatsModel.FK_Allstar_Player"/> <NavigationProperty Name="AllstarFull" ToRole="AllstarFull" FromRole="Player" Relationship="BaseballStatsModel.FK_AllstarFull_Player"/> <NavigationProperty Name="Appearance" ToRole="Appearance" FromRole="Player" Relationship="BaseballStatsModel.FK_Appearances_Player"/> <NavigationProperty Name="AwardPlayer" ToRole="AwardPlayer" FromRole="Player" Relationship="BaseballStatsModel.FK_AwardsPlayers_Player"/> <NavigationProperty Name="AwardSharePlayer" ToRole="AwardSharePlayer" FromRole="Player" Relationship="BaseballStatsModel.FK_AwardsSharePlayers_Player"/> <NavigationProperty Name="Batting" ToRole="Batting" FromRole="Player" Relationship="BaseballStatsModel.FK_Batting_Player"/> <NavigationProperty Name="BattingPost" ToRole="BattingPost" FromRole="Player" Relationship="BaseballStatsModel.FK_BattingPost_Player"/> <NavigationProperty Name="Fielding" ToRole="Fielding" FromRole="Player" Relationship="BaseballStatsModel.FK_Fielding_Player"/> <NavigationProperty Name="FieldingOF" ToRole="FieldingOF" FromRole="Player" Relationship="BaseballStatsModel.FK_FieldingOF_Player"/> <NavigationProperty Name="FieldingPost" ToRole="FieldingPost" FromRole="Player" Relationship="BaseballStatsModel.FK_FieldingPost_Player"/> <NavigationProperty Name="Pitching" ToRole="Pitching" FromRole="Player" Relationship="BaseballStatsModel.FK_Pitching_Player"/> <NavigationProperty Name="PitchingPost" ToRole="PitchingPost" FromRole="Player" Relationship="BaseballStatsModel.FK_PitchingPost_Player"/> </EntityType> 

The OData feed can also contain Associations that define the connections (or roads from our earlier analogy) between the Entity Type and another Entity Type. An example would be the Association between a Baseball Player and his Batting Statistics. An Entity Type’s collection of Associations is called an Association Set and along with the Entity Set is assembled into an Entity Container. The Link or Navigation Property that makes up the Entity Type must act on behalf of a defined Association in the OData feed. The following is an example of what the Entity Container looks when querying the Service Metadata Document.

<EntityContainer Name="SolutionEntities" xmlns:p7="http://schemas.microsoft.com/ado/2009/02/edm/annotation" m:IsDefaultEntityContainer="true" p7:LazyLoadingEnabled="true"> <EntitySet Name="Entity1" EntityType="SolutionModel.Entity1"/> <EntitySet Name="Entity2" EntityType="SolutionModel.Entity2"/> ...
    <EntitySet Name="EntityN" EntityType="SolutionModel.EntityN"/> <AssociationSet Name="FK_Entity2_Entity1" Association="SolutionModel.FK_Entity2_Entity1"> <End Role="Entity2" EntitySet="Entity2"/> <End Role="Entity1" EntitySet="Entity1"/> </AssociationSet> <AssociationSet Name="FK_Entity1_EntityN" Association="SolutionModel.FK_Entity1_EntityN"> <End Role="Entity1" EntitySet="Entity1"/> <End Role="EntityN" EntitySet="EntityN"/> </AssociationSet> ...
    <AssociationSet Name="FK_Entity2_EntityN" Association="SolutionModel.FK_Entity2_EntityN"> <End Role="Entity2" EntitySet="Entity2"/> <End Role="EntityN" EntitySet="EntityN"/> </AssociationSet> </EntityContainer> 

A special type of structured types that can be in an OData feed is a Complex Type. The Complex Type is a collection of properties without a unique Key. This type can only be contained within an Entity Type as a property or live outside of all Entity Types as temporary data.

The last item that can be represented in the Entity Data Model is a Service Operation. We will look at the Service Operation later in the series. For now understand that Service Operations are functions that can be called on an OData feed. A Service Operation behaves similar to the Stored Procedures in a relational database.

We have looked at the Entity Data Model and what defines it in the world of OData. This will allow us to lay down a foundation for future blog posts in this series to explain the behaviors and results that we expect from our OData feeds.

31 Days of OData – Day 2 Data Types of OData

OData-logo_biggerSince data is the basis for all OData feeds it is natural to see then that describing the data that represents the types Entities with in the feed is important. It is not only important for the data but also for the metadata that plays a significant role in the OData protocol.

The OData protocol is a very structured standard and with it also come a set of primitive data types. Each data type has a distinct set of properties themselves and we will look at each and understand those characteristics. Let’s dig into the list shall we?

What are the Data Types for OData?

I will give the list of primitive data types that can be used with the OData protocol and additionally I will give some of the characteristics for each type. We all should know most of these data types but it will be a good refresher.

Primitive Types

Description

Notes

Examples

Null

Represents the absence of a value

 

null

Edm.Binary

Represent fixed- or variable- length binary data

X and binary are case sensitive. Spaces are not allowed between binary and the quoted portion. Spaces are not allowed between X and the quoted portion. Odd pairs of hex digits are not allowed.

X’23AB’

Edm.Boolean

Represents the mathematical concept of binary-valued logic

 

Example 1: true

Example 2: false

Edm.Byte

Unsigned 8-bit integer value

 

FF

Edm.DateTime

Represents date and time with values ranging from 12:00:00 midnight, January 1, 1753 A.D. through 11:59:59 P.M, December 9999 A.D.

Spaces are not allowed between datetime and quoted portion. datetime is case-insensitive

datetime’2000-12-12T12:00′

Edm.Decimal

Represents numeric values with fixed precision and scale. This type can describe a numeric value ranging from negative 10^255 + 1 to positive 10^255 -1

 

2.345M

Edm.Double

Represents a floating point number with 15 digits precision that can represent values with approximate range of ± 2.23e -308 through ± 1.79e +308

 

Example 1: 1E+10 Example 2: 2.029

Example 3: 2.0

Edm.Single

Represents a floating point number with 7 digits precision that can represent values with approximate range of ± 1.18e -38 through ± 3.40e +38

 

2.0f

Edm.Guid

Represents a 16-byte (128-bit) unique identifier value

 

’12345678-aaaa-bbbb-cccc-ddddeeeeffff’

Edm.Int16

Represents a signed 16-bit integer value

 

Example 1: 16

Example 2: -16

Edm.Int32

Represents a signed 32-bit integer value

 

Example 1: 32

Example 2: -32

Edm.Int64

Represents a signed 64-bit integer value

 

Example 1: 64L

Example 2: -64L

Edm.SByte

Represents a signed 8-bit integer value

 

Example 1: 8

Example 2: -8

Edm.String

Represents fixed- or variable-length character data

 

Example 1: ‘Hello OData’

Edm.Time

Represents the time of day with values ranging from 0:00:00.x to 23:59:59.y, where x and y depend upon the precision

 

Example 1: 13:20:00

Edm.DateTimeOffset

Represents date and time as an Offset in minutes from GMT, with values ranging from 12:00:00 midnight, January 1, 1753 A.D. through 11:59:59 P.M, December 9999 A.D

   

Where do the Data Types for OData come from?

Where do the datatypes for OData originate is a great look at the history of OData and what other products helped shape the protocol. OData originated with Microsoft so first we will look at where most data resides when developing solutions on the Microsoft stack of tools and technologies: SQL Server. When the OData protocol was announced back in 2010 most of the data types used in Microsoft SQL Server 2008 could be used to represent data in an OData feed. It would only seem logical that a technology that was developed with an organization would be shaped and influenced by the tools at hand and OData is no exception.

But that is just the start. We must also look at the Entity Framework as another key influencer in the maturation of the OData protocol. If you notice in the table above the list of the data types all have the prefix “Edm.” associated. That comes from the Entity Framework to mean “Entity Data Model”. Why is this so? It could be that other data types will be allowed at some time and that some with the same literal name could be brought into the OData protocol specification but with slightly different characteristics. If that happened these new set of primitives could conflict with the existing data types (example could be datatypes from Oracle).

The OData team was smart enough to allow for this and started using prefixes that could distinguish possibly a different representation of a string by two different database products (example could be the maximum fixed length of a string). These new data types could be given their own prefix and happily live side by side with the original data types from SQL Server and Entity Framework.

What about Spatial Data Types?

The Spatial data types that first were brought to the Microsoft world in SQL Server 2008 are a new exciting feature of both the Entity Framework 4.0 product but also for OData. These new data types are so exciting that I will be spending an entire blog post covering these later in the month. I will update and link this blog post chapter to that future post so stay tuned.