tag:blogger.com,1999:blog-29445172862786507042024-03-12T11:19:34.261+00:00Life's too short for blogging...Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-2944517286278650704.post-13642366891029376462013-10-19T00:54:00.001+01:002013-10-20T20:39:36.660+01:00Robust logging in applications using functional parametersJust as logging components in applications should have no side effects on the components themselves the act of logging should not throw exceptions and cause an application to crash or a process to fail. Many times I have seen some or all of the following used as log statements: log.Debug(string.Format("Value x: '{0}' - Value y: '{1}'", obj.Property, SomeFunction());
My issue with thisAnonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com1tag:blogger.com,1999:blog-2944517286278650704.post-23472699830913843442013-02-26T14:29:00.001+00:002013-09-18T15:52:04.016+01:00Auto mocking with NSubstitute and WindsorI have now fully embraced the world of auto mocking and can now see past the illusion of magic and see it for its wire-up cleanliness. I do not want to have to introduce an additional frameworks,  I am a lover of NSubstitute and generally use Windsor as my IoC of choice. The following explains how to create an auto mocking test framework using the two however I am sure you can adapt it to Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-80753272029472271752012-10-27T17:43:00.000+01:002012-10-27T17:43:29.730+01:00Loading a Certificate from the Certificate Store via a Custom Configuration SectionI have recently been doing a fair amount of work with Windows Identity Foundation (WIF). In doing so I have had to load up certificates so in order to make the application flexible enough to deploy to different environments, use different certificates and follow certain standards I wanted to load the certificates from the Windows Certificate Store. I knew that some of the other frameworks in theAnonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-74544998545566978952012-10-15T22:40:00.000+01:002012-10-15T23:02:50.933+01:00ASP.NET Desktop Membership Manager ApplicationLast month I started up an open source project on CodePlex with a couple of developer friends. The application is for helping developers and system administrators to release ASP.Net web projects to a given environment where they have no ability to manage the ASP.Net Membership accounts. Either because the web application does not have user management yet or there is no need for membership Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-63456791993993199672012-10-11T23:04:00.000+01:002012-10-12T16:23:56.467+01:00Migrating Authentication out of your ASP.Net applications into a Single Sign-on Secure Token ServiceIt happens every time we create a new ASP.Net application we talk about doing something better than using ASP.Net membership but it never happens and before you know it your live using the SqlMembershipProvider database. Now you are trapped because removing it would be a big change and the business requires you to focus on more important features. BUT that is not true, this post will go through Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com7tag:blogger.com,1999:blog-2944517286278650704.post-84276270511567960452012-08-16T16:32:00.000+01:002012-08-16T17:07:56.803+01:00Public WCF contract legacy testingI work on a project that contains a number of public facing WCF interfaces and recently we were doing a pre release to our test environment when we found out that our public contracts were not working, the interfaces were fine but some of the data members of the contracts were not being serialized. On inspecting the WSDL we realised that some of the namespaces had been changed, it turns out when Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-85944661525159397952012-04-04T01:01:00.000+01:002012-04-04T01:21:57.610+01:00Passing mocked parameters between AppDomainsCurrently I have been doing a lot of Acceptance Testing which has become more and more complex of late. One of the issues was separating out our systems that all run in the same process in the context of our Acceptance Tests. These are all NUnit test which use StoryQ and are run by the ReSharper and TeamCity NUnit test runners. To achieve the separation each of the systems is run in it’s own Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com4tag:blogger.com,1999:blog-2944517286278650704.post-34719012047263104222011-11-21T19:53:00.001+00:002011-11-21T19:53:11.870+00:00Custom WCF security tokenThis has been hanging around in my drafts for a while. I have just been looking at Secure Token Services and decided to dust this off before posting any of my findings with STS’s. A while back I was involved in a smart client application for a customer that used a mixture of WCF and Microsoft Synchronization Framework for downloading offline data from our system. One of the interesting aspects Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com1tag:blogger.com,1999:blog-2944517286278650704.post-27506198041127506172011-09-28T18:48:00.000+01:002011-09-28T19:12:55.074+01:00Hosting a Mock as a WCF serviceThere are a number of times where I have wanted to fire up a dummy WCF service that can be used in unit tests and be able to run some assertions against. Previously I use to write a wrapper class for my mock with the same interface and proxy all the calls to the mocked object as per the following example. [ServiceBehaviour(InstanceContextMode = InstanceContextMode.Single)
<!--CRLF-->
Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com5tag:blogger.com,1999:blog-2944517286278650704.post-16462922455832431452011-06-28T18:28:00.001+01:002011-06-28T18:29:36.863+01:00yUML–> A web based tool for generating simple UML diagrams for use in blogs, forums and wikisI came across yUML viewing someone's answer on Stack Overflow. It allows you to generate quick diagrams using a simple syntax that can then be presented in a blog. With just a few lines of syntax you can generate a diagram and a url that can be inserted into a blog post or forum. [Customer{bg:orange}]+1->*[Order{bg:green}]
<!--CRLF-->
[Order]++1-items >*[LineItem{bg:red}]
<!-Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-23903585331163025032011-06-27T23:52:00.000+01:002011-06-28T13:32:03.129+01:00Creating the ASP.Net Application Services Database from code without having to use aspnet_regsql.exeRecently I have been trying to run some user acceptance tests and have been struggling to generate a membership database for use with the asp.net membership provider on the fly and then clean up afterwards. I like to generate test database with unique names as not to clash with other tests that might be running on the test box and this had been proving rather hard. I started of trying to Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-46427507412489666642011-01-02T13:04:00.000+00:002011-01-02T13:26:48.597+00:00Making Fluent NHibernate AutoMapper behave with interfacesI’ve been an avid user of NHibernate for some time now either using the built in class maps or Castles ActiveRecord. It hasn’t been until recently that I have started using Fluent NHibernate and have been wowed by how easy it is to do the class mappings with the ClassMap base class. This is an improvement over ActiveRecord where domain objects are tightly bound to ActiveRecord because of the Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com5tag:blogger.com,1999:blog-2944517286278650704.post-72941682292795786902010-10-26T01:04:00.001+01:002010-10-26T01:04:33.966+01:00Host TeamCity in IIS7Up until recently I have been using the apache isapi redirector to proxy through from IIS to TeamCity (which runs on Tomcat). This was because I had no alternative until today. Whilst searching the interwebs I came across the Application Request Routing extension for IIS7. This amongst other things allows IIS to proxy through to a service running either locally or remotely running on any port. Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com2tag:blogger.com,1999:blog-2944517286278650704.post-7110345911061375762010-06-29T16:27:00.001+01:002010-06-29T16:36:36.175+01:00Better know a framework: Flushing the System.IO.StreamWriterI ran into an issue today where content that was being written to a Stream was being truncated when a large amount of text was being written. The code was something similar to: using (var memoryStream = new MemoryStream())
<!--CRLF-->
using (var streamWriter = new StreamWriter(memoryStream , Encoding.UTF8))
<!--CRLF-->
{
<!--CRLF-->
streamWriter.Write(Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-42870070668938213192010-06-16T17:18:00.000+01:002010-06-16T17:19:08.736+01:00Using the IMapper interface with the System.Converter delegateRecently I wrote a post about using a standard mapping interface for your mappers which gave the added benefit of providing an easy way to write an extension method for mapping enumerable. As it turns out it also has the added benefit in fitting in with the System.Converter delegate signature in that the signature of the Map method of the IMapper interface is the same as the System.Converter Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-4575400875139006452010-06-16T10:00:00.001+01:002010-06-16T23:14:36.909+01:00Support SQLCE BinaryBlob and StringClob in NHibernate without depending on System.Data.SqlServerCeOut of the box NHibernate 2 does not support the BinaryBlob or StringClob sql types for SQL Server compact 3.5. This results in NText and Image fields being truncated. One of the common workarounds you can find on the web is to override the existing SqlServerCeDriver and cast the parameter to an SqlCeParameter and manual set the parameter types to NText and Image. using System.Data;
<!-Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-720074083575814342010-06-10T18:38:00.001+01:002010-06-29T01:12:59.633+01:00Taking the pain out of parameter validationOne of the biggest pains I find when writing API components is validating parameters. Now don’t get me wrong I don’t mind validating a parameter and failing quickly to ensure that your component works correctly it’s the tediousness of the code that bothers me. Take the following method signature for example. public void SomeMethod(SomeObject someObject, int maxValue)
<!--CRLF-->
{
<Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com4tag:blogger.com,1999:blog-2944517286278650704.post-40946542547432350942010-06-10T11:11:00.001+01:002010-06-10T11:12:56.980+01:00Configuration ignoranceA good friend of mine, Stephen Oakman, did a post on how to hide your dependencies on a particular configuration implementation (Using a configuration provider). I wanted to touch on the basics of the post and show how that can be achieved with a complex implementation of a configuration structure using the System.Configuration namespace objects and builds on my original post of Generic Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-50295877641904718112010-06-09T17:41:00.002+01:002010-06-09T17:52:55.894+01:00Automatic collection mapping for your mappersI was going through our code base the other day and found a large number of mapper objects and their related interfaces. They all looked something like this: public class SomeObjectMapper<!--CRLF-->{<!--CRLF--> public ObjectA Map(ObjectB source)<!--CRLF--> {<!--CRLF--> //Perform mapping and return.<!--CRLF--> }<!--CRLF--> <!--CRLF--> public IEnumerable<ObjectA> Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-23970452024848924972010-06-09T15:45:00.004+01:002010-06-09T16:31:52.841+01:00Fed up with writing methods to copy one stream to anotherI constantly find myself writing static methods in my applications to copy one stream into another so I finally decided  to add an extension method to our internal library. There is a method on the MemoryStream class called WriteTo which does this but I wanted it to be available to all instances of Stream. public static void CopyTo(this Stream input, Stream output, int bufferSizeAnonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com1tag:blogger.com,1999:blog-2944517286278650704.post-57738615863133110822009-09-18T09:53:00.002+01:002009-09-18T10:19:06.999+01:00Injecting service certificates into a WCF end point using Windsor’s WcfIntegrationI recently hit an issue whilst using Windsor’s WCF Integration Facility (see previous post on configuring the the facility) to create a WCF end point. Previously the WCF integration was working fine but I had to change the binding to a wsHttpBinding and use a mutual certificate to secure the message. Normally you would setup the endpoint binding to load the required certificate out of the Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com0tag:blogger.com,1999:blog-2944517286278650704.post-87523098866954633882009-09-17T17:32:00.001+01:002009-09-18T10:05:12.401+01:00Using Windsor to inject dependencies into your WCF services with WCF Integration FacilityIoC is pretty cool but sometimes you can’t use it straight out of the box with say something like WCF. Well now you can thanks to Ayende Rahien. Windsor contains a WCF Integration Facility that provides a WCF ServiceHostFactory which is used to create a service host for your service and injects any dependencies registered in Windsor. This is frighteningly simple to configure as you will see. Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com2tag:blogger.com,1999:blog-2944517286278650704.post-12908203288914376912009-09-09T14:58:00.002+01:002010-06-09T18:38:19.789+01:00Generic configuration element collectionTiered of endlessly writing your custom ConfigurationElementCollection classes and duplicating your code. Well so was I which is why I ended up abstracting out the core functionality into an abstract base class. This is a similar approach to the one Richard Adleta used in his post on A generic ConfigurationElementCollection implementation but with some differences. public abstract class Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com7tag:blogger.com,1999:blog-2944517286278650704.post-21317234466114430822009-06-12T12:18:00.002+01:002009-09-10T16:16:59.015+01:00Project assembly reference fun and gamesWe just had an issue with the build of one of our applications on our CI server. The build in question no longer contained an assembly in the bin folder where previously it had. Pinpointing the issue At first I couldn’t understand why the assembly was not in the bin folder as the assembly was clearly marked in Visual Studio as “Copy Local = true”. I then looked through the build history to see Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com11tag:blogger.com,1999:blog-2944517286278650704.post-43578741061930294102009-06-10T10:55:00.000+01:002009-09-09T15:53:23.490+01:00ClickOnce updates via authentication proxy(Disclaimer: This is my first blog post) You may be aware that ClickOnce installation and updating is not supported via proxy servers that require authentication credentials other than the users default credentials. http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/82be8797-f14f-4db1-acb8-3206881cc567. The thread suggests that there is hot fix but as far as I am aware this does Anonymoushttp://www.blogger.com/profile/05091436116360365279noreply@blogger.com16