Tuesday, October 09, 2007
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.



10/9/2007 4:08 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
Just so I don't forget this is the syntax.
Imports Lan = Langauge

Where Language is the namespace and Lan is the alias.

And not the other way round which I apparently find more logical.

Especially usefull if you got a namespace and a variable that share the same name (which shouldn't happen ;-)).


10/9/2007 1:49 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
Balls

Try it, on a dual monitor setup it is even more fun since the balls can't pass the border.

10/9/2007 1:30 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
So someone tell me why you get to this blog by searching viagra? I never used the word :-).



10/9/2007 11:25 AM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
Allthough I don't get them very often Nullref exceptions do happen and guess what they even happen with VS




This ussually means I have to restart VS ;-).
10/9/2007 11:21 AM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, October 03, 2007
Apparently this will help get the hits up

Technorati Profile
10/3/2007 4:07 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, October 02, 2007
Funny I just noticed that the dasblog textbox has an insertcode button and you can even enter VB.Net code.

Everyday I become a little smarter. Soon I will be concurring the world ;-).

10/2/2007 3:42 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
Today I found this little piece of code

Public Class SingletonProvider(Of itemtype As {New})
    Public Sub New()
    End Sub


    Public Shared ReadOnly Property Instance() As itemtype

        Get
            Return SingletonCreator.instance
        End Get

    End Property
    Class SingletonCreator
        Shared Sub New()
        End Sub

        Public Shared ReadOnly instance As itemtype = New itemtype()
    End Class
End Class

From this site.

I find this very usefull code since it will allow me to create singleton forms. Making Forms singleton is nearly impossible as we all know because of the designer and VS. So we have to work around that a bit (yeah I know it's bad when you have to work around the IDE to get something done). And that's where this piece of code comes in handy.

10/2/2007 3:39 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
 Sunday, September 30, 2007
Today I worked on making a Weathercontrol for windowsForms. I based it very loosely on this article but I made it more MVCish and layered. I'm still working on the comments and test but here it is so far.




The file can be found here

You will need to register here.

Find the settings file that contains the settings (hey I'm not going to tell you everything) and change them appropriately. Meaning add you Licensekey, partnerId and LocationId.

I will try and improve it in the next couple of days. Stay tuned.

Oh yeah, feel free to use it.



9/30/2007 6:22 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback
 Saturday, September 29, 2007
Lately I have been having a bit of trouble with settings files. There was a time where I thought they would be just the thing that you needed for configuration but now I 'm not so sure anymore. Anyway first I will show what settings files are since I think not many people use them. BTW I'm talking about settings files that are used in Visual studio and I think that's they went a bit overboard on them.

So here is how you create them. Just right click your project and then click add and new item.




You could change the name ofcourse but be a good programmer and be lazy ;-) .

And this is how it looks after you click Add.





I added 2 settings FormText as String with the scope of User and LabelText with the scope of Application. The scope thing is important since Application scoped settings can only be changed in the designer (Well that was the intention anyway) and User scoped settings can be changed by the "User". Meaning at runtime.

So there you have it the settings file in short.In the next part I will explain how they can be used (even simpler) and what files VS created to make this work.


9/29/2007 12:47 PM Romance Daylight Time  #    Disclaimer  |  Comments [0]  |  Trackback