Today I had a little problem with component mapping and the attributes. And It has something to do with the fact that all my objects use interfaces.

I had this in my MspResult class.

<NHibernate.Mapping.Attributes.ComponentProperty(componenttype:=GetType(Littlexyz))> _
        Public Overridable Property Littlexyz() As Interfaces.ILittleXyz Implements IMspResult.Littlexyz
            Get
                _Log.LogDebug("Property Littlexyz - returning _Littlexyz")
                Return _littlexyz
            End Get
            Set(ByVal Value As Interfaces.ILittleXyz)
                _Log.LogDebug("Property Littlexyz - setting _Littlexyz")
                _littlexyz = Value
            End Set
        End Property```
And this in the Littlexyz class.

<NHibernate.Mapping.Attributes.Component())> _ Public Class Littlexyz Implements ILittleXyz

#Region “ Private members “ “’ <summary> “’ A local variable called _x of type Decimal “’ </summary> “’ <remarks>Has Property X</remarks> Private _x As Decimal``` Which gave me this error in nhibernate

NHibernate.MappingException: Problem trying to set property type by reflection —> NHibernate.PropertyNotFoundException: Could not find field ‘_x’ in class ‘Model.Msp.Interfaces.ILittleXyz’

Which is completely correct since the interface doesn’t have any private fields.

But the solutiion was simple 😉 as always it just took a little searching.

So i just changed the Littlexyz class to this.

``` <NHibernate.Mapping.Attributes.Component(classtype:=GetType(Model.Msp.Littlexyz))> _ Public Class Littlexyz Implements ILittleXyz

#Region “ Private members “ “’ <summary> “’ A local variable called _x of type Decimal “’ </summary> “’ <remarks>Has Property X</remarks> Private _x As Decimal``` Which does exactly what I want and what it should.