WILT: NHibernate – An association from the table MyTable refers to an unmapped class: MyClass

If you are sure that you already created the mapping for MyClass, the first thing to check is that you change the BuildAction Property for the mapping file MyClass.hbm.xml to Embedded Resource.

This can be done by right-clicking on the mapping file in Solution Explorer and then clicking on Properties. The BuildAction is the first property in the list.

WILT: Comparing 2 Lists in C#

I wanted to compare if 2 lists (List<T>) were equal meaning that they contained items that were equal and not that the 2 lists were actually the same object.

I made the mistake to use the Equals() method and of course got a false returned to me when I was expecting the 2 lists to be equal. The method to use is SequenceEquals() which is actually available for any class implementing IEnumerable.

SequenceEquals on MSDN

WILT: Inherit and Implement in C#

WILT: What I Learned Today

This is a new category of posts I decided to start to record by daily learnings. I am sure that a lot of those posts are going to be embarrassing because they will expose basic things I should have known for a long time but, oh well…
One of the things I enjoy the most with my job is that I learn everyday. Some days I learn about small details, other days I learn more complex techniques or theories.

Anyway, today’s post is about creating a class that both inherit from another class and implements an interface.

This is very straight forward and a frequent occurence but the little “trick” here is to list the inherited class(es) first.

   1: public class MyClassA

   2: {

   3:     ...

   4: }


   6: public interface IMyInterface

   7: {

   8:     ...

   9: }


  11: public class MyClassB : MyClassA, IMyInterface

  12: {

  13:     ...

  14: }