AussieALF Blog

Jul
15
2010

XPO + WCF = Awesomeness

User Rating: / 1
PoorBest 

OK so I have finally finished the re-write of the entire communications library for my project. It has been a massive clean up and ALOT of refactoring to bring things back to a satisfactory level.

Verdict? WCF is a vastly better platform for “remoting”, once you get your head around the passing of Contracts and how to “configure” your bindings/behaviours you’ll find a very flexible/powerful and seemingly reliable communications platform.

I can now offer 2 forms of communications from my client, TCP and HTTP, TCP uses a binary formatter which makes it more efficient on bandwidth but less compatible with Firewalls and Proxies, whereas HTTP is based on SOAP text which makes the transport a little more “heavy” but ultimately more compatible with the clients network setup.

So how does XPO fit in with all this? well easy actually, as all your doing is exposing the Datastore communication in the same matter you do with remoting.

Authentication is being handled by a custom Username validation which checks the XPO database for valid username and password combination and then allows access to the datastore.

Overall I am quite happy with the setup, I was using .NET Remoting for data communication and Secure FTP for File transfer, this proved a nightmare for configuration of firewalls (needed 1 port for data, 1 port for FTP Comms and a port range for FTP Passive transfer) and made it impossible for Proxies.

Now with WCF handling both data and files and via either TCP or HTTP it provides the most flexibility and also now provides me a platform for Silverlight development which I am very keen to get in to.

So I still have another week or two of some much needed bug/feature work that has been buliding up while rewriting my backend, once this is done I can then start posting some more information.

In summary the start of August is when I will be continuing my posts with the added benefits of understanding WCF and LINQ-2-XPO.

Have a good one peeps.

 
Jun
06
2010

What happened to me?

Well for all those people that wondered what happened to that post I was going to do about 2 months ago… here it isn’t ;)

I have unfortunately been stuck on a project.

My main project has been using .NET Remoting for XPO services and things were great, however over unreliable services such a 3G and Wireless I have found that .NET Remoting has some serious weaknesses. The basic weakness is no reliable session, in other words there is nothing to ensure packets arrive in the correct order and also doesn’t handle retrying (outside of what the TCP Transport layer does).

So pretty much I had to bite the bullet, I had to move my product out of the dark ages (.NET 2) and bring it up to date. So my choice was either 3.5 or 4. In the end I went with .NET 4, I figured I will have to include the framework anyway so I might as well include .NET 4.

This of course brings with it Windows Communication Foundation (WCF) which was included in .NET 3 and since then been improving with each release of the framework.

Learning WCF has been a interesting journey, I had used ASMX Web Services in the past before moving to .NET Remoting. I can say the WCF is vastly different in comparison.

It has also opened my eyes up a bit more to Service Oriented Architecture (SOA) which makes you have to think a bit differently.

I just read “Learning WCF” by Michele Bustamante (http://oreilly.com/catalog/9780596101626/?CMP=OTL-GB2088480187&ATT=9780596101626) which has really helped alot. I have also started reading “Programming WCF Services” by Juval Löwy this seems to duplicate a fair bit from “Learning WCF” but seems to be just as informative.

So where does this leave my blog posts, well to be quite frank, probably still a couple of months away ;(

However there is a plus side to this, I will be posting my findings on XPO and WCF in the coming month. So far my initial testing has been promising.

One of the other reasoning for the move to WCF is the ability to then use Silverlight as a secondary interface to my application.

I will keep you informed. Till then happy programming to all.

 
Apr
13
2010

Some Delays on my next post :(

Due to some unforseen workloads I haven’t been able to get to my second post on XPO, I don’t see it happening until mid next week, just thought I would at least post that I wouldn’t be posting, :D

Happy VS2010 Day.

 
Apr
10
2010

Simple Collection to “Lock” Controls using DX Editors

I have a base form that I inherit from within my App it makes it easy to put in helper functions such as my Bind method and this Control locking mechanism.

Basically I inherit from List(Of Control) then Shadow the Add and Remove functions to alter the properties of the control when being locked and unlocked.

This doesn’t take into account Windows Controls with the Enabled property but could easily be extended to work with Windows controls, (I just haven’t dealt with them in so long I wouldn’t even now how to lock them down these days ;))

    Protected Class BMSLockedControlCollection
        Inherits List(Of Windows.Forms.Control)


        Public Shadows Sub Add(ByVal control As Windows.Forms.Control)
            If Not IsLocked(control) Then
                SetLocked(control, True)
                MyBase.Add(control)
            End If
        End Sub

        Public Shadows Sub RemoveAll()
            For i As Integer = 0 To (Me.Count - 1)
                SetLocked(Item(0), False)
                MyBase.RemoveAt(0)
            Next
        End Sub

        Private Shadows Sub Remove(ByVal control As Windows.Forms.Control)
            SetLocked(control, False)
            MyBase.Remove(control)
        End Sub

        Public Function IsLocked(ByVal control As Windows.Forms.Control) As Boolean
            If TypeOf Control Is DevExpress.XtraEditors.BaseEdit Then
                Return CType(Control, DevExpress.XtraEditors.BaseEdit).Properties.ReadOnly
            ElseIf TypeOf Control Is DevExpress.XtraGrid.GridControl Then
                Return Not CType(CType(control, DevExpress.XtraGrid.GridControl).FocusedView, DevExpress.XtraGrid.Views.Base.ColumnView).OptionsBehavior.Editable
            ElseIf TypeOf Control Is BaseControl Then
                Return CType(control, BaseControl).IsReadOnly
            End If
        End Function

        Public Sub SetLocked(ByVal control As Windows.Forms.Control, ByVal Locked As Boolean)
            If TypeOf control Is DevExpress.XtraEditors.BaseEdit Then
                CType(control, DevExpress.XtraEditors.BaseEdit).Properties.ReadOnly = Locked
            ElseIf TypeOf control Is DevExpress.XtraGrid.GridControl Then
                CType(CType(control, DevExpress.XtraGrid.GridControl).FocusedView, DevExpress.XtraGrid.Views.Base.ColumnView).OptionsBehavior.Editable = Not Locked
            ElseIf TypeOf control Is BaseControl Then
                CType(control, BaseControl).IsReadOnly = Locked
            End If
        End Sub
    End Class

    Private _lockedControls As BMSLockedControlCollection
    Protected Property LockedControls As BMSLockedControlCollection
        Get
            If _lockedControls Is Nothing Then
                _lockedControls = New BMSLockedControlCollection
            End If
            Return _lockedControls
        End Get
        Set(ByVal Value As BMSLockedControlCollection)
            _lockedControls = Value
        End Set
    End Property


    Public Sub LockControl(ByVal control As Control)
        If Not LockedControls.Contains(control) Then
            LockedControls.Add(control)
        End If
    End Sub

    Public Sub UnlockControl(ByVal control As Control)
        If LockedControls.Contains(control) Then
            LockedControls.Remove(control)
        End If
    End Sub

    Public Overloads Sub LockAllControls(ByVal Unlock As Boolean)
        LockAllControls(Me.Controls, Unlock)
    End Sub

    Public Overloads Sub LockAllControls(ByVal controls As ICollection, ByVal Unlock As Boolean)

        If Unlock Then
            LockedControls.RemoveAll()
        Else
            For Each Control As Windows.Forms.Control In controls
                LockedControls.Add(Control)
                If Control.Controls IsNot Nothing AndAlso Not TypeOf Control Is BaseControl Then
                    LockAllControls(Control.Controls, Unlock)
                    LockedControls.Add(Control)
                End If
            Next
        End If
    End Sub

 
Mar
31
2010

Need your input

The recently posted XPO from the beginning is going to turn out to be a 8 post behemoth ;)

As you can imagine, laying this all out in a blog post can be very time consuming. What I am hoping to do is use Camtasia and provide a screencast of the steps and talk my way through it.

I could then just post the “Demo” content such as Project/Database etc and a summary of what was covered.

I personally like text and screenshots to follow instead of video (but don’t like to create it ;)), but video is more engaging and I can say alot more within the video (and in context to what is on teh screen) than in text.

I would love to hear your comments, thanks

 

Should AussieALF stay bald?




Results

Latest Comments

My Twitter

Follow me on twitter