Home
May 20
Sunday

We build Strong Reliable Foundations

Why the emphasis? We believe in building high quality. We believe in craftsmanship. We believe that anything worth doing is worth doing right. These are not just cliche sayings that we tell our clients or pitch to prospects. This is how we run our business. This is how we build. This is how we design. This is how we innovate, and inspire. This is how we engineer.

Time Lapse In Motion :: Motion Time Lapse Cinematography by Aidan Maguire.

Subclassing with FluentNHibernate and using DiscriminatorValue

Recently I came across what I thought to be a very odd behavior of NHibernate. The following is basically some mappings I had defined for my Model:

public class BaseMapping: ClassMap<BaseClass>
    {
        public BaseMapping()
        {
            Id(x => x.Id);</div>
            DiscriminateSubClassesOnColumn("IsClassA", true).AlwaysSelectWithValue();
        }
    }
public class ClassAMapping: SubclassMap<ClassA>
    {
        public ClassAMapping()
        {
            DiscriminatorValue(true);

        }
    }
public class ClassBMapping: SubclassMap<ClassB>
    {
        public ClassBMapping()
        {
            DiscriminatorValue(false);
        }
    }

Using AlwaysSelectWithValue forces NHibernate to use the constraint on all the queries it generates for Class A or Class B.

To be honest, I’m not quite sure why this isn’t the default, since situations arise that can be very weird, especially when dealing with collections of ClassA or ClassB. I recently had a situation where I queried for a list of ClassA elements, but it was returning all base types, meaning it wasn’t excluding ClassBs in my query.

Last Updated on Saturday, 16 October 2010 09:59

Considerations when running Win 7 in VMWare: 3D Acceleration

When running WPF apps inside a Win 7 guest, there is a known bug in VMWare Workstation that causes apps which render 2D and 3D controls to not render properly on ReDraw.

As a temporary fix, disabling 3D acceleration on the guest vm settings causes the redraw issue to go away, although your guest OS will have it’s hardware acceleration limited.

Last Updated on Saturday, 16 October 2010 09:59
Home