Skip to main content

Posts

Showing posts with the label c#

Windows Azure AppFabric Service Bus Queues API

  Recently Microsoft released a new App Fabric SDK 2.0 CTP including some great new features, You can grab all the bits and pieces from here and/or read the release notes . Some of the highlights include:  Publish/Subscribe which are called Topics Message Queues Visual Studio Tools AppFabric Application Manager Support for running WCF & WF The part that interested me the most is the Queues feature and that is what I’m going to be exploring in this post. Overview of Queues Message Queues are not a new concept allow for more reliable and scalable communication between distributed systems than pure request/response. Solutions like MSMQ, NServiceBus already exist to solve this problem for locally connected systems.  What the Queues API provides is that it provides similar features but the messages are being transported across the internet and persisted in the cloud.   There is currently a Message Buffer available in Azure b...

Using Entity Framework 4 with MySQL

  If you’re on the .NET Platform then MS SQL Server is usually the de-facto choice for the RDBMS. However if you’re at all cost conscience then you will realize that scaling and replication is going to cost you a fair chunk of change in licensing fees. For that reason open source RDBMSs and in particular MySQL offer a much cheaper alternative. In this post I’d like to demonstrate how you can use Entity Framework 4 with MySQL. MySQL Connector Net 6.3.6 The first thing you’ll need to do is download and install the latest version of the MySQL Connector for .NET from http://dev.mysql.com/downloads/connector/net/ Make sure that Visual Studio is closed when you install. Pascal Case Table Names Because we are going to generate our Entity Framework Model of an existing database we want to make sure that the entity names use pascal casing. By default MySQL on Windows forces lowercase table names. You can change this behaviour by adding lower_case_table_names=2 to your my.ini file...

Specification Pattern, Entity Framework & LINQ

  Firstly just to clarify I am going to be talking about the OOP Specification Pattern not the data pattern commonly found in the SID (Shared Information & Data) model. Much has been said about the specification pattern so I’m not going to go into that, if you want an overview check out these posts: http://www.lostechies.com/blogs/chrismissal/archive/2009/09/10/using-the-specification-pattern-for-querying.aspx http://devlicio.us/blogs/jeff_perrin/archive/2006/12/13/the-specification-pattern.aspx In this post I’m going to demonstrate how you can make use of the specification pattern to query Entity Framework and create reusable, testable query objects and eliminate inline LINQ queries. The Smell When I first got started with Entity Framework way back in 2008 when EF was still in it’s infancy we had lot’s of inline LINQ all over the code base and specific methods on our repositories for querying requirements (which any OOP purist will tell you is bad). We had ...

Managing Change in Long Running Workflows Part 2

  Recently I wrote about how some of the Serialization problems you can face when dealing with long running workflows. In this post I’m going to cover how I deal with logic changes in persisted workflows and also how you can make logic changes to your workflows without having to deploy code. Hosting the Workflow When it comes to hosting your workflows there are really only two options to consider. Self-Hosting WCF Workflow Service To be honest I only looked at the WCF Workflow Service model briefly and decided it wasn’t the best fit for the requirements as it couldn’t provide the same benefits of self-hosting within a Workflow Application . Workflow Instance Store In order to persist Workflow instances you need to first create the Workflow Instance Store database. For this you will need to use the following scripts: C:\Windows\Microsoft.NET\Framework\v4.0.30319\SQL\en\SqlWorkflowInstanceStoreSchema.sql C:\Windows\Microsoft.NET\Framework\v4.0.30319\SQL\en\Sq...

Managing Change in Long Running Workflows Part 1

  I’ve been using Workflow Foundation now for over a year and it has become an integral part of our architecture and has by and large been very successful. However it is not without it’s issues, the single most being that official documentation is light at best and relevant blog posts are quite rare.   I recently ran into a fairly serious problem after deploying a new release of our Software. The Problem I received this lovely email from our exception tracker: System.Runtime.DurableInstancing.InstancePersistenceCommandException: The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}LoadWorkflow was interrupted by an error. ---> System.Runtime.Serialization.SerializationException: Deserialized object with reference id '73' not found in stream. The key part is “Deserialized object with reference id '73' not found in stream.” As I’m sure you can tell this does not really provide any helpful i...

SharpKit C# to Javascript Convertor

  Recently I discovered SharpKit whilst looking at an online IDE called CodeRun . SharpKit is described as “a Web Toolkit that enables you to write C# and convert it to JavaScript during compilation.” There are a number of other similar tools around that try and achieve the goal of writing in a Static language and then converting it to JavaScript. Some of those include:  GWT (Google Web Toolkit) Script # jsc I can’t speak for jsc or Script # but I’ve had a good look at GWT and although I can see the benefits it reminded me a bit of the ASP.NET WebForms model in that the high level of abstraction has a big learning curve. The SharpKit feature list is very impressive. This is the first time I have tried SharpKit so I’m going to do a very simple walkthrough and how to get started. Installation Grab the Download from the SharpKit website and run the Installer. As SharpKit is a commercial product they require you to Register before Download...