Simple OData implementation with LinqToPI

Discussion created by MichaelvdV@Atos on Apr 21, 2010

Steve mentioned OData in his blogpost.


Microsoft provides an easy way to create OData Services using WCF Data Services. I have played around a bit when it still was called Astoria/ADO.NET Data Services. Steve's blogpost got me interested again.


Wouldn't it be nice if you could just access your PI data like



and get all the PI point information for the sinusoid tag? or



and get the snapshot information for the cdt158 tag? Better still, what if you can make selections based on criteria you specificy in the URL... With OData you can.


Using LinqToPi it's very easy to create a simple OData service.


This for instance gets the metadata for cdt158



This gets the product information from the PI Productversion table



This gets the snapshot for cdt158



This one gets archive values




The source code for this (very simple) service is included as an attachment (Visual Studio 2010 / .NET 4.0)


What do you guys think of this approach? A REST approach to getting PI data seems very nice.