Posted in .NET, Programming on October 30th, 2008 3 Comments »
Everytime I try and get Ayende’s NHibernate Query Analyzer to work I seem to encounter some weirdness. Here’s what I did to get it running this time.
Download the version appropriate to your version of NHibernate. For me, that was 1.2GA
Create a new app.config file, and into it place just the NHibernate configuration section and the [...]
From Wikipedia, “Kaizen is a Japanese philosophy that focuses on continuous improvement throughout all aspects of life”. After a review of our systems from a software coach in the department, I decided to instigate a weekly Kaizen session for the whole dev team. (I first heard of the term Kaizen a few years ago when [...]
Had a problem with NHibernate Lifecycle events recently where they appeared not to be firing when I was hitting ISession.Save(entity). After some investigation I finally realised that if you create a new entity, then query NHibernate it may implicitly persist the transient object during a Flush. When it does this any interceptors will be fired [...]
The system i’m working on at the moment recently went into systest and we found a couple of database errors relating which NHibernate was throwing an exception of
Unexpected row count: -1, expected 1
This wasn’t happening on the development system so we took the apparently faulty database from systest and ran it in [...]
Having upgraded the website I work on to .net 2.0, one of our console apps failed whilst talking to a webservice on the site. We’d not changed anything on either the console app, or the website other than upgrading the website to 2.0.
The error message was “global:System.Collections.IList cannot be deserialized because it does not have [...]
Spent a while trying to get sub-projects opening within Visual Studio today where the root project has SSL security setup. Every time VS tried to open the sub-projects it would error with the message “Secure channel failed”.
Figured it out eventually - you need to add a location element to the web.config for the get_aspx_ver.aspx to [...]
[csharp]
using System;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace SocialAnimal.Web.UserControls
{
/// <summary>
/// If ControlToValidate has a value then DependantControl
/// must also have a value
/// </summary>
public class DependantFieldValidator : CustomValidator
{
private string _dependantControl = null;
private bool _showAlertBox = false;
[Description(@"If true, will show an alert box if the control validates false, otherwise will display an inline message"),
Category("Behavior")]
public bool ShowAlertBox
{
get { return _showAlertBox; [...]
The website I work on recently received a large increase in visitors due to a marketing drive. This caused IIS to start recycling the worker process very often as memory consumption was increasing out of control. The user experience wasn’t affected by this problem as we run a load-balanced system, however we had to fix [...]
Here’s a quick example of how we do layer seperation through interfaces to make each layer testable. Although the tests run, the UI section is untested. Download file.
[csharp]
using System;
using System.Web;
using System.Web.UI;
using NMock;
using NUnit.Framework;
using Socialanimal.Example.Business;
using Socialanimal.Example.Business.Implementation;
using Socialanimal.Example.Core.Entities;
using Socialanimal.Example.Core.Interfaces;
using Socialanimal.Example.SqlDatabase;
namespace Socialanimal.Example.Core.Entities
{
public class Employee
{
public string Forename;
public string Surname;
public Employee(string forename, string surname)
{
this.Forename = forename;
this.Surname = surname;
}
}
}
namespace Socialanimal.Example.Core.Interfaces
{
public interface [...]
It’s been a while since I wrote about the C# tools / frameworks i’m currently using, so here we go.
log4net - for all our logging needs.
nunit - automated testing.
nmock - for mocking interfaces and writing more testable code. (see my blogpost)
nant - automating our build cycles (although we’re looking at msbuild to replace Cruise Control, [...]