Mike Taulty's Blog
Bits and Bytes from Microsoft UK

December 2007 - Mike Taulty's Blog

Blogs

Mike Taulty's Blog

Elsewhere

  • ADO.NET Data Services - LINQ to SQL and Associations

    One of the things that I didn't mention (because I didn't know and I'm still not 100% sure :-)) in this post was what happens with associations when you're using ADO.NET Data Services and non-Entity Framework providers. If you've got an Entity Framework data source exposing Customers and Orders then your metadata looks like this; <? xml version ="1.0" encoding ="utf-8" standalone ="yes" ? > < Metadata > < Schema Namespace ="NorthwindModel" xmlns:dataWeb ="http://schemas.microsoft.com/ado/2007/08/dataweb" xmlns ="http://schemas.microsoft.com/ado/2006/04/edm" > < EntityContainer Name ="NorthwindEntities" dataWeb:IsDefaultEntityContainer ="true" > < EntitySet Name ="Customers" EntityType ="NorthwindModel.Customers" /> < EntitySet Name ="Orders" EntityType ="NorthwindModel.Orders" /> < AssociationSet Name ="FK_Orders_Customers" Association ="NorthwindModel.FK_Orders_Customers" > < End Role ="Customers" EntitySet ="Customers" /> < End Role ="Orders" EntitySet ="Orders...
  • ADO.NET Data Services and CLR Namespaces

    If you're seeing this error when using the webdatagen.exe tool with the Data Services CTP; error 7001: Schema specified is not valid. Errors: (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:TName spaceName' - The Pattern constraint failed. Then look to put the types that you're exposing (i.e. the T that you have fed into WebDataService<T>) into a CLR namespace. If you're still getting the error, put the types that your type T exposes as public IQueryable members into a namespace (the same one seems to work for me). If you're using LINQ to SQL then one way of doing that is to select your LINQ to SQL diagram and then use the property sheet; to set the "Context Namespace" and "Entity Namespace " settings.
  • MacOS Leopard and VMWare

    I bought a shiny new iMac just after Leopard shipped (actually as soon as Apple had finished Leopard and were offering it as a £5 addition to an iMac). I've been really pleased with it although it's had some teething troubles such as; Not reliably connecting to my wi-fi network (which I resolved by getting rid of wi-fi and moving to powerline-ethernet as all my machines seem to struggle with wi-fi). Offering very poor connectivity to my Vista Media Center. No idea whether this is Vista or Leopard but there's a few rumours out there that Leopard has SMB problems and I've yet to resolve mine. Other than that, I'm a very satisfied customer. I've gone through a few loops like "How do I play a WMV file then?", "What client do I use for blogging" and so on but, generally, they've all been easy to resolve. Just recently, I've realised that it'd be nice to run some Windows apps on my Mac and I started looking at virtual solutions. Naturally, being a Microsoft chap I started by looking at Virtual PC but that looks to be...
  • ADO.NET Data Services - Filtering Across Assocations

    It took me a little while to figure out the URI syntax for querying across associations. Based on Northwind I can do something like; WebDataService.svc/Orders?$filter=(Customers/Country)%20eq%20('UK') to navigate from an Order (named Orders here) to its Customer (named Customers here). How to navigate the other way foxed me a lot more (is this stuff written down somewhere? :-)). Say I want to select the Customers but only the ones which have an Order where the Freight value is over a certain threshold. How do I form that query? I don't think you can in the current CTP as there's no operators like count or exists so you'd need to write a service operation to do that kind of navigation right now.
  • "Advanced Windows Debugging"

    I keep seeing this book; attracting a lot of attention on blog-sites. It sounds pretty good so I think I'll be looking for a copy post-Xmas. I think the ability to debug quickly is a huge big part of being a software developer and there's always room for improvement so it'll be good to see how this compares with the classic John Robbins books. Along with the current drive for Test-Driven Development I'd like to see Debugger-Driven Development :-) It's surprising what glaring mistakes you find if you apply a rule that you single step every line of code in the debugger immediately after you've written it.
  • ADO.NET Data Services Training Series

    Today I found Jonathan Carter's growing series of posts over here on ADO.NET Data Services; ADO.NET Data Services Training Series They are fantastic and well worth a read if you're interested in this kind of framework. I particularly like the way that the point was made about "Data Services" exposing pretty much any data you've got (whether relational or not) as I think that's a really strong aspect of the framework - the ability to take pretty much anything and expose it over REST. It'd be cool to play with that idea at a later point with some custom classes. I came across this whilst reading the Astoria Team Blog and, specifically, the post around Query and Change Interceptors up here .
  • LINQ to SQL - Tailoring the Mapping at Runtime

    Mats has a post over here about concurrency in LINQ to SQL with a long write-up about issues that he sees in using the framework. I've not read all of it yet because the very first point that he raises sent me off on a bit of a tangent (which does not necessarily provide an answer to any/all of his post - it's just something that it caused me to think about). The first point is - in the case where you (for whatever reason) don't want optimistic concurrency with LINQ to SQL, how would you turn it off globally? As far as I know there's no "override" flag that you can set anywhere to just switch off concurrency checking and (given that the default value for UpdateCheck is Always) you're going to have to visit all the "Column attributes" somehow and tweak that value. LINQ to SQL doesn't offer you the opportunity to customise the code-generation process like the Entity Framework does so there's not much you can do there AFAIK. So, what are the options for tweaking a mapping using the UpdateCheck flag as a particular...
    Filed under: , ,
  • ADO.NET Data Services - Using LINQ to SQL rather than LINQ to Entities

    Something that's been foxing me is that I've read about ADO.NET Data Services now supporting a "provider" model such that it's no longer tied to the Entity Framework. I hadn't done this myself until today but was reading this great post and was wondering how this stuff could work given that IQueryable isn't enough to do read/write so I thought I'd better give it a try. So, I get going; New Web Site project. Insert a new Entity Framework model based on Northwind. Insert a new Web Data Service. Change my service to derive from WebDataService<NorthwindEntities > Open up all access to my service by changing the generated InitializeService method to allow all access. Run up the browser and I'm in business. So, I've got entities coming back in response to URI's. I then go and build a client. I do; New console project. Add a reference to Microsoft.Data.WebClient (I'm finding these in c:\program files\reference assemblies\...) Go and use the WebDataGen.exe tool to generate me some client classes from my service...
  • ADO.NET Data Services - Experimenting with .NET Client Access Whilst Sniffing the HTTP Traffic.

    What flows backwards and forwards between a .NET "Data Services" client and its service? I've exposed Northwind. Querying Let's do a query from a .NET client (with generated code from the webdatagen tool); NorthwindEntities en = new NorthwindEntities( "http://mthpvista/DSTest/WebDataService.svc" ); en.MergeOption = MergeOption.AppendOnly; Customers c = (from x in en.Customers where x.CustomerID == "ALFKI" select x).First(); Console.ReadLine(); And here's the response - essentially, that LINQ query translates into a URI; Customers('ALFKI') and the response I get back is formatted for ATOM; <? xml version ="1.0" encoding ="utf-8" standalone ="yes" ? > < entry xml:base ="http://mthpvista/DSTest/WebDataService.svc/" xmlns:ads ="http://schemas.microsoft.com/ado/2007/08/dataweb" xmlns:adsm ="http://schemas.microsoft.com/ado/2007/08/dataweb/metadata" adsm:type ="NorthwindModel.Customers" xmlns ="http://www.w3.org/2005/Atom" > < id > http://mthpvista/DSTest/WebDataService.svc/Customers('ALFKI') <...
  • ADO.NET Data Services - Getting Started (2)

    The bits for ADO.NET Data Services ("Astoria") primarily seem to live in an assembly Microsoft.Web.Data.dll (which I'm referencing from c:\program files\reference assemblies). I'd say that the key class in there is WebDataService<T> which implements pretty much the lowest level of WCF ServiceContract that you can implement ( Christian pointed this out the other day ) in that it looks like this; [ServiceContract] public interface IRequestHandler { // Methods [WebInvoke(UriTemplate= "*" , Method= "*" ), OperationContract] Message ProcessRequestForMessage(Stream messageBody); } Which says (to me) - "give me a message and I'll give you one back and I'll answer a call for any URI and any HTTP method if invoked over the web". It also implements IWebDataService which is an internal interface which brings together; internal interface IWebDataService { // Properties WebDataServiceConfiguration Configuration { get; } IWebDataServiceHost Host { get; } IWebDataServiceProvider Provider { get; } } Of these, for me, the...
  • ADO.NET Data Services - Getting Started

    If you want to get started with ADO.NET Data Services then I recommend the docs up here - short and sweet but they get you up and running.
  • Downloaded ADO.NET Data Services

    ...and followed Christian's great advice over here to get myself hosted inside of a console application; Self-Hosting Your ADO.NET Data Services ( Astoria ) Services took about 3 minutes. Now need to figure out what the heck I can do with this framework in its revised form.
  • Video: SQL 2008 and FileStream (writing data)

    Short video on working with the new varbinary (max) filestream data type in SQL Server 2008. Hover near the bottom of the player for controls. Double-Click the player for full-screen. I don't have a downloadable version at the time of writing so will update the post later when I have one. The post was updated on 11th March, 2010 - this video can now be found here
    Filed under: , ,
  • Video: SQL 2008 and FileStream (reading data)

    Short video on working with the new varbinary (max) filestream data type in SQL Server 2008. Hover near the bottom of the player for controls. Double-Click the player for full-screen. I don't have a downloadable version at the time of writing so will update the post later when I have one. This post was updated on 11th March, 2010 - the video can be found here
    Filed under: , ,
  • ASP.NET V3.5 Extensions Preview Available

    Including the MVC bits, dynamic data bits, Silverlight Controls (those look to come with the same/similar templates that Expression Encoder has) and also ADO.NET Entity Framework and Data Services. I hadn't quite picked up on this but perhaps ASP.NET Extensions has become the ship vehicle for ADO.NET Entity Framework? More details up here
1 2 3 Next >