Mike Taulty's Blog
Bits and Bytes from Microsoft UK

DataServices - Mike Taulty's Blog

Blogs

Mike Taulty's Blog

Elsewhere

  • ADO.NET Data Services Session at SQL Bits Manchester

    A big thanks to all the people who came along to my session at SQLBits today on ADO.NET Data Services and also to the organisers and community around SQLBits that made the event happen in the first place. I was there for most of the afternoon and it seemed like a fantastic event to me in a cool venue. As promised, my slides from the session are here for download – you’ll perhaps notice that there are a few additional (hidden) slides in the slide-deck that I didn’t use in this talk as I collapsed this talk down from an earlier talk and updated it to reflect the RTM version of Data Services and also the various CTPs/Previews that are currently kicking around. So…you get a little more than I actually used at the conference. Enjoy :-)
  • Astoria Online/Offline

    Tantalising post from the Astoria team.
  • Added (Updated) ADO.NET Data Services Videos to C9

    I produced a new set of short videos around ADO.NET Data Services and dropped them on to Channel 9. You can find them here; http://channel9.msdn.com/tags/UK and that list will grow as time goes in ( specifically, it'll grow if I can get the publishing system to publish my next 4 videos for me as it's not playing ball at the time of writing :-) ).
  • Silverlight and ADO.NET Data Services ( 2 )

    Following on from this last post , if I start to edit the data in the grid and change some value then the property value will change in the underlying class but nothing else will happen. That is, the NorthwindEntities class which is managing my data for me client-side ( which is derived from DataServiceContext ) isn't going to be aware of those modifications. Why not? If we have a look at a property on a generated class such as this one for the CompanyName on the Customers class; public string CompanyName { get { return this ._CompanyName; } set { this .OnCompanyNameChanging( value ); this ._CompanyName = value ; this .OnCompanyNameChanged(); } } Now, OnCompanyNameChanging and OnCompanyNameChanged are partial methods with no implementation by default so nothing's going to happen when something like the DataGrid changes a value such as CompanyName. Similarly, the generated entity classes such as Customers do not implement INotifyPropertyChanged which means that changes in the data will not be reflected in the UI...
  • Silverlight and ADO.NET Data Services

    Someone mailed me to ask whether I had a video on how to put together Silverlight and ADO.NET Data Services. I don't at the time of writing and I've also got a cold right now ( thank you, Microsoft Manchester office :-) ) so I thought I'd write something rather than record it. Let's run through a step-by-step thing. Visual Studio 2008 - File->New->Web Site. I'm going for the filesystem and C# as below; Now, to make it easy to work with ADO.NET Data Services, I'm going to add in an ADO.NET Entity Data Model for Northwind. That is ... Website->Add->New Item; I say "yes" to add it to my app_code folder, then select; and then I can go and add a new ADO.NET Data Service ( again via Website->Add New Item ); and then I can update my service code to read; public class Service : DataService<NorthwindEntities> { // This method is called only once to initialize service-wide policies. public static void InitializeService(IDataServiceConfiguration config) { config.SetEntitySetAccessRule( "*" , EntitySetRights...
  • ADO.NET Data Services - IUpdatable on LINQ to SQL

    I made an attempt at implementing IUpdatable on the current (i.e. VS 2008 Sp1 B1) bits of ADO.NET Data Services. I struggled a little bit with this. When you produce a data service you provide a class which is derived from; DataService<T> and T might be your own custom type or it's more likely to be a class derived from DataContext ( LINQ to SQL ) or ObjectContext ( LINQ to Entities ). The framework reflects over the type that you provide as T in order to find public properties of type IQueryable<> and it can expose those ( if you tell it to ) as entity sets available over your service. If T is not an ObjectContext then the framework also looks to T to implement IUpdatable if you want to do read/write access to your data. It's extremely likely that if you're working with LINQ to SQL or LINQ to Entities then your type T will be the type that is generated from the tooling for you because that type already comes pre-populated with lots of IQueryable<> public properties nicely generated for you which...
  • ADO.NET Data Services and LINQ to SQL - Errors Generating Proxy Code with DataSvcUtil.exe

    Something that I came across today - if you're trying to surface a LINQ to SQL data source via the latest build of ADO.NET Data Services and you're running datasvcutil.exe on the metadata of the service then you might find yourself with a whole bunch of errors. Here's a sample of what I was getting this morning; error 7001: Schema specified is not valid. Errors: $metadata(0,0) : error 0005: The 'Namespace' attribute is invalid - The value '' is invalid according to its datatype ' http://schemas.microsoft.com/ado/2006/04/ edm:TNamespaceName' - The Pattern constraint failed. For me, I resolved this by just making sure that I revisited my DBML diagram for LINQ to SQL in Visual Studio and set the "Entity Namespace" property for code generation. That is, click on the white-space of the diagram; to make sure that you have the diagram rather than a particular entity set selected. Then hit F4 for the properties; and give yourself a namespace and all the errors seem to go away reasonably quickly :-)
  • Authorising with ADO.NET Data Services

    Once we've got a request authenticated the next thing we might want to consider is authorising those requests as they make access to data. In researching this post I found that I'd actually written about this before but hadn't been quite as complete as I'd like to be ( and, to be honest, with my 5-minute memory I'd forgotten that I'd written it ) so these posts; ADO.NET Data Services & Authentication - Basic Auth in IIS 7 ADO.NET Data Services - More Sketchy Thoughts on Access Control ADO.NET Data Services - Sketchy Thoughts on Controlling Access just become "backgrounders" for this post with the caveat that they are now a little out of date as Data Services has moved on. With Data Services we have the possibility to make a bunch of entity sets available to a client and often I use the Northwind database as my example which would mean that if I was just exposing its raw schema I would see something like; Customers, Orders, Products, Shippers, etc. and we also have the opportunity to expose service operations...
  • ADO.NET Data Services - Concurrency in Action

    Just like for batching, there's a great explanation of how concurrency looks in ADO.NET Data Services up here so this is just a basic example. If I take the "Hello World" style service that I built back here then it does nothing about concurrency checking because, by default, when you build an entity data model with the Entity Framework tooling all of the concurrency options are set to "off". So, if I make a request for a customer and trace it with Fiddler then I see; You can see that I'm requesting the ALFKI customer and I'm just doing it from a browser as it happens. Now, if I go and alter my entity data model a little bit to say that ( purely for instance ) I want to have concurrency checking done on the PostalCode, Country, Region, Address fields of the Customers entity type as in; Then the next time I request that entity I see an ETag header being emitted that contains the value of my concurrency token; and if I was to request lots of customers then I'd see these ETags move into the response data as in; From...
  • ADO.NET Data Services - Batching in Action

    I did a talk on Data Services at DevDays, Amsterdam last week and so I had to take a rather speedy look at batching support as that had been added to the VS 2008 Sp1 bits since the previous preview. Batching is explained up here but here's just a little example of using it. If we take "hello world" style service that we created back in this post and we were to do something like this from the .NET client side code; static void Main( string [] args) { Console.ReadLine(); NorthwindEntities proxy = new NorthwindEntities( new Uri( "https://localhost/SecureSite/Secure/Service.svc" )); foreach (Shippers s in proxy.Shippers) { Console.WriteLine(s.ShipperID); } foreach (Employees e in proxy.Employees) { Console.WriteLine(e.EmployeeID); } Console.ReadLine(); } and if we were to go ahead and trace that traffic with Fiddler then we'd see; That is - we see and HTTP GET request for Shippers and then another one for Employees. Now, if these 2 entity sets are related then we can use the $expand query string operator in order...
  • ADO.NET Data Services - Identity columns and id values on the client

    Someone asked me about this so I thought I'd share here. The question was around how you can work with database generated values and have them returned to the client after the insert. My experiment ran like this. I created a table; create table test ( id int identity primary key not null , someColumn nvarchar(30) not null ) I created a website project, added an entity model which only has the table above in it and then added an ADO.NET Data Service and exposed my entity model through it in the standard way. I then used webdatagen.exe in order to read the metadata and build client proxy code. I then used that proxy class (called demoEntities below) to write a client; demoEntities entities = new demoEntities( "http://localhost:32768/WebSite1/ServiceOne.svc" ); entities.MergeOption = MergeOption.OverwriteChanges; test newTestRecord = new test() { someColumn = "foo" }; entities.AddObject( "test" , newTestRecord); entities.SaveChanges(); Console.WriteLine( "New id is {0}" , newTestRecord.id); and that all seemed to...
  • ADO.NET Data Services - Screencasts

    I made a few videos about Data Services. I have plans to make a few more as well but (as always :-)) I've got distracted by something else so, for the meantime; ADO.NET Data Services - Surfacing Data ADO.NET Data Services - Querying with URI's ADO.NET Data Services - A Basic .NET Client ADO.NET Data Services - A Basic AJAX Client ADO.NET Data Services - A Basic Silverlight Client I particularly enjoyed the Silverlight one which I stayed up into the small hours of the morning making. Why? Because of how closely it lines up with what you do in a full .NET application. Once Silverlight grows some controls and databinding in version 2.0 I really see Silverlight+Data Services as being a killer combination.
  • ADO.NET Data Services - Silverlight Add-On

    Just a quick link to make this easier to find; ADO.NET Data Services Silverlight Add-On
  • "Using ADO.NET Data Services CTP1"

    I keep searching the web to find this useful document about Data Services; Using ADO.NET Data Services CTP1 so I'm linking to it here for my own sanity :-) Maybe it's installed as part of the SDK. Maybe it's on another website somewhere but I can never find it when I want it (well, ok, I can now I've saved it to my desktop :-)) and so I'm including it here.
  • ADO.NET Data Services - More Sketchy Thoughts on Access Control

    One of the things that I briefly mentioned in this post was the idea that because Data Services sits atop of WCF you can plug in a ServiceAuthorizationManager which gets a chance to look at every request before it gets dispatched into your data service. Whilst you can write explicit interceptors that pick up CRUD operations for particular entities, you might want to just have some roles such as createRole, readRole, updateRole, deleteRole and it'd be a bit painful to have to write lots of interceptor methods to enforce this. That is, it'd be nice if Data Services had a single place where you could inject code to run before (and possibly after ) each operation but I don't think it has one in the current CTP. A ServiceAuthorizationManager implementation might help a little here though. I might do something like this to try and determine who it is that's calling my service and whether I allow them to do it based on a role; public class AuthManager : ServiceAuthorizationManager { static AuthManager() { // Probably...
1 2 Next >