Mike Taulty's Blog
Bits and Bytes from Microsoft UK

August 2007 - Mike Taulty's Blog

Blogs

Mike Taulty's Blog

Elsewhere

  • MSDN Events in Leeds (in association with Black Marble)

    Just a bit of a "plug". The chaps from Black Marble are being kind enough to host MSDN events in Leeds and I'm going there on the 20th September with Martin to talk about .NET Framework V3.0 and .NET Framework V3.5. You can find details of the event here - hope to see you there.
  • SQLBits Community Event

    The SQLBits Community Day Registration Site is now open for you to register to attend the event on the 6th October at Microsoft Campus down in Reading. You can also take a look at the sessions and vote for the 10 that you would most want to see and that will drive the process as to what sessions actually end up happening on the day. I'm a bit peeved that I'm missing this. I missed the previous DDD day because I was on holiday in (well, ok, the holiday was better than the DDD so I admit it was a fair swap) and I'm missing this as I'm booked up that day elsewhere. Hopefully, the next "DDD like" event will be one that I can get to.
  • QuickLinks: System.AddIn and the Microsoft AddInFramework

    System.AddIn in Framework V3.5 is about building hosts that load plug-in Add-Ins with functionality around discovery, isolation and lifetime management. It also tries to deal with the thorny problem of versioning one or both ends of the host<->addin relationship. I didn't know too much about the thorny details of this so I thought I'd forward the links I used to learn a little more about it (read in the following order); MSDN Magazine Article 1 MSDN Magazine Article 2 Approaches to Discovery How Discovery Works (I wish MS folks would write more articles like this. That is, my view is that I just want to know "What code did you just build into your framework piece and how does it do what it does?". If you tell me that then I can figure the rest). Architecture This I found interesting only for the statement "The host and add-in only ever depend on one component (the view) which itself has no dependencies elsewhere on the system. This means that the host and add-in are completely unaware of each other and the...
  • ADO.NET Entity Framework - Bringing Together A Few Previous Posts

    This is just a convenience - links to the posts that I've made so far around beta 2 of the ADO.NET Entity Framework. The Overview Video Entity Framework - Overview Video Note: This is also available on my Live SkyDrive in 5 pieces if that helps. "Getting Up and Running" Posts ADO.NET Entity Framework Beta 2 &amp; August Tools CTP Entity Framework - Installation. System.Data.Entity.dll Entity Framework - Metadata Files. SSDL Schema Entity Framework - Metadata Files. CSDL Schema Entity Framework - Metadata Files. MSL Schema EdmGen Posts Entity Framework - Tooling. EdmGen.exe - Generating SSDL, CSDL, MSL from Northwind Designer Posts Entity Framework - Designer. Generating an EDMX file from Northwind in Visual Studio Entity Framework - Tooling. Simple Inheritance in the Designer Entity Framework - Tooling. EDM Designer & SQL 2008 Entity Framework - Entity Data Model Wizard and SQL CE Entity SQL & Entity Provider Posts Entity Framework - Entity Provider Level. First Querying of Northwind Model EntityFramework...
  • Viewport2DVisual3D and Friends in WPF V3.5

    I'm fairly poor at 3D. I was optimistic when WPF came along because I felt it might suddenly turn me into "3D guy" but it didn't (it was, perhaps, asking a lot :-)). I can just about sit down and produce a mesh that defines a plane or (once) I managed to define a cube and everytime I get to the TextureCoordinates bit I have to go back to first principles. So...I'm never going to be your source of WPF 3D information but I did have a quick look at ContainerUIElement3D, ModelUIElement3D and Viewport2DVisual3D today so I thought I'd share. This is the only information that I really found about this topic right now . All other hits from Google (yes, I know) seemed to be repro's of that article. There's nothing AFAICT in the MSDN docs for Beta 2 so I really struggled to figure anything out. In my own layman's terms; ContainerUIElement3D - you can put 3D content in here. If you do, this element can do things for like handling input, firing events and so on without you having to do lots of hit-testing yourself. ModelUIElement3D...
  • WCF V3.5 in Partial Trust

    I tried to build a WPF XBAP that called a WCF service from its partially trusted environment using VS 2008 Beta 2 and managed to make it work but there's a bit in the docs that you need to read if you're playing with this stuff. I don't have an online reference for it but the local MSDN topic is; ms-help://MS.MSDNQTR.v90.en/wcf_con/html/a36a540b-1606-4e63-88e0-b7c59e0e6ab7.htm if that's of any use. The topic is called "Feature Compatibility when Running Partially Trusted". Essentially, the topic says; Use BasicHttpBinding, WebHttpBinding, WSHttpBinding (transport security only) Don't use MTOM Don't use reliable messaging, transactions, secure conversation. Some other limitations around serialization. And some other bits and pieces. What I also found was that if you try and configure via a Config file then you might (i.e. I did) hit an issue when you hit your <bindings> section as that seemed to bring into play an assembly that didn't allow partially trusted callers for me so I ended up avoiding any <bindings>...
  • Entity Framework - Object Services Level. CUD with Stored Procedures.

    How would you get the Entity Framework to map inserts, updates, deletes through a stored procedure layer rather than dynamically asking the underlying provider to generate INSERT/UPDATE/DELETE statements? I was about to write some code when I came across this post (again :-)) so I spent the time reading all of that which is a really good description instead of opening VS :-)
  • Entity Framework - Entity Data Model Wizard and SQL CE

    I was just trying to build a default EDM from the Northwind database with this wizard; and every time I got to the page above it simply exited (i.e. disappeared). I figured that I must have broken it but then I've been messing around with SQL Compact today and had to do a reinstallation and I noticed that my Server Explorer in VS had a connection to a SQL CE database that it didn't used to have. So, being suspicious, I deleted that connection to SQL CE (leaving 2 connections to 2 SQL databases) and then tried the Wizard again - success! Not sure if there was something suspect about my SQL CE connection or whether this is just a bug in the beta but if you find this one day in a search then I hope it helps you :-)
  • Outlook Connector for Live Mail

    I've been missing the ability to use Outlook in order to send/receive Live Mail for quite a while. You used to be able to do that at one time and then I think the service changed so that you couldn't. Regardless, it's back and I'm really pleased to see it back because, for me, the web UI of Live Mail (whilst very nice) just isn't anything like as useful as the local UI of Outlook. Here's the download (works with 2003, 2007); http://www.microsoft.com/downloads/details.aspx?FamilyID=7aad7e6a-931e-438a-950c-5e9ea66322d4&displaylang=en
  • Office Does ClickOnce

    This is the first time I tried this since getting VS 2008 Beta 2 and I can't see many blog posts out there on it (i.e. I searched for help and didn't find any) so I thought I'd share. Using Beta 2, I began a new Office project - went for Excel as Excel is my favourite. So, that's File->New Project. I went for a Workbook customisation; Let it create a new doc for me; Added a new item to the project (went for a Ribbon customisation with the UI editor rather than XML); Got the visual designer; Changed the tab type so that it wasn't "Built-In" but, rather, one of my own; Popped along to the Toolbox (Hey, there's a lot more controls on here than in Beta 1 :-)) and got a button; Dragged it to my group on my tab; Set its properties so that it displayed a nice happy face and had a label; Put some code behind its Click Handler; private void button1_Click( object sender, RibbonControlEventArgs e) { MessageBox.Show( "Hello!" ); } I'm considering this the ultimate in Office Solutions :-) so I want to ship it. I went ahead...
  • WorkflowServiceHost in Beta 2 - Getting to the Workflow Runtime

    In Beta 1 of Fx3.5, the WorkflowServiceHost had a simple property on it called Runtime that got you to the WorkflowRuntime . Easy :-) I was just trying to move some code from B1 to B2 and realised that this property had gone and, fortunately, found this post over here; http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2061771&SiteID=1 which explains where to get it should you need it; WorkflowRuntime workflowRuntime = ((WorkflowRuntimeBehavior)host.Description.Behaviors.Find<WorkflowRuntimeBehavior>()).WorkflowRuntime; It's a bit more lengthy than; host.Runtime but at least you can still get there :-)
  • Entity Framework - Object Services Level. Transactions.

    How do transactions play with the Entity Framework? As a starting point, if I do something like; static void Main( string [] args) { using (NorthwindContext ctx = new NorthwindContext( "Name=NorthwindEntities" )) { foreach (Shippers s in ctx.Shippers) { s.Phone = "Bar" ; } ctx.SaveChanges( true ); } } Then, from the SQL Profiler I can see that a transaction is being created for me by SaveChanges and is committed at the point where SaveChanges succeeds (it'll be rolled back in the case where SaveChanges fails). Here's the complete profiler trace; So, that's reasonably obvious - the query executes on its own and then the updates are all bounded for me by a transaction created by the SaveChanges method. If I wanted the transaction to also include the query then I could use a TransactionScope to control that. The chances are that I'd be doing that because I wanted to change the transaction isolation level so I could do something like; static void Main( string [] args) { using (NorthwindContext ctx = new NorthwindContext...
  • Entity Framework - Object Services Level. Concurrency.

    If we're going to be updating or deleting records in the database then we probably care about concurrency. What happens if we've got code like this; static void Main( string [] args) { using (NorthwindContext ctx = new NorthwindContext( "Name=NorthwindEntities" )) { Shippers s = ctx.Shippers.Where( "it.shipperid = 13" ).First(); s.Phone = "123" ; Console.WriteLine( "ready to make an update - go update the table to cause a concurrency problem" ); Console.ReadLine(); ctx.SaveChanges( true ); } } And, in the middle of this piece of code at the point where I've got that Console.ReadLine() I go off and update the record where shipperid=13 in order to change its phone number to a different value. What does the Entity Framework do in that situation? Nothing :-) The update simply goes through to the table. So, is there no concurrency protection in the Entity Framework? Yep, there is - you just have to turn it on. If I go an modify my .CSDL file for the Shippers EntityType to read; < EntityType Name ="Shippers" >...
  • Entity Framework - Object Services Level. Deleting and ObjectStateManager.

    Following the general theme of the last couple of posts ( here and here ), I thought I'd carry on and experiment with deleting. static void Main( string [] args) { using (NorthwindContext ctx = new NorthwindContext( "Name=NorthwindEntities" )) { Shippers s = ctx.Shippers.First(); ctx.DeleteObject(s); DumpObjectStateManager(ctx.ObjectStateManager); DumpShippers(ctx.Shippers); } } static void DumpShippers(IEnumerable<Shippers> shippers) { Console.WriteLine( "Dumping" ); foreach (Shippers s in shippers) { Console.WriteLine( "\tShipper id [{0}], name [{1}], tel [{2}]" , s.ShipperID, s.CompanyName, s.Phone); } } Now, a couple of interesting things here. Firstly, when we hit the DumpObjectStateManager we get; Dumping Object State Manager Dumping objects in state [Detached] Dumping objects in state [Unchanged] Dumping objects in state [Added] Dumping objects in state [Deleted] Entity from entity set [Shippers], key [<Key=ShipperID,Value=1>] Dumping objects in state [Modified] Dumping Shipper id [1], name...
  • Entity Framework - Object Services Level. Updating and ObjectStateManager.

    Following on from the previous post I wanted to apply a similar approach with updating data. If I go and grab the first Shippers record from my store; using (NorthwindContext ctx = new NorthwindContext( "Name=NorthwindEntities" )) { Shippers single = ctx.Shippers.First(); DumpObjectStateManager(ctx.ObjectStateManager); single.Phone = "Unlisted" ; DumpObjectStateManager(ctx.ObjectStateManager); } Then dumping that ObjectStateManager twice shows that its aware of what's going on here; Dumping Object State Manager Dumping objects in state [Detached] Dumping objects in state [Unchanged] Entity from entity set [Shippers], key [<Key=ShipperID,Value=1>] Dumping objects in state [Added] Dumping objects in state [Deleted] Dumping objects in state [Modified] Dumping Object State Manager Dumping objects in state [Detached] Dumping objects in state [Unchanged] Dumping objects in state [Added] Dumping objects in state [Deleted] Dumping objects in state [Modified] Entity from entity set [Shippers], key [<Key=ShipperID...
1 2 3 4 5 Next >