vb.net syntax for CSLA 4.3.12

vb.net syntax for CSLA 4.3.12

Old forum URL: forums.lhotka.net/forums/t/12895.aspx


st3fanus posted on Friday, June 05, 2015

Hi all ,

currently i used csla ver 4.3.12 in c#. but recently I got a small project which need vb.net as language

so, i need a easy migration from my c# syntax into vb.net ?

 

could anyone give a suggestion ?

public static readonly PropertyInfo<string> InvNoProperty =
            RegisterProperty<string>(t => t.InvoiceNo);
        public string InvoiceNo
        {
            get { return GetProperty(InvNoProperty); }
            private set { LoadProperty(InvNoProperty, value); }
        }

into a vb.net ????

 

thanks

stefanus

 

ajj3085 replied on Friday, June 05, 2015

Well plugging that into a converter I get this:

Dim InvNoProperty As PropertyInfo(Of StringRegisterProperty(() => {  }, t.InvoiceNo)

    
    
Public Property InvoiceNo As String
        Get
            Return 
GetProperty(InvNoProperty)
        
End Get
        Set
            
LoadProperty(InvNoProperty, value)
        
End Set
    End Property

But off the top of my head the PropertyInfo doesn't look to have had the static parsed correctly (Shared in Vb.net I think?).  Or the readonly, which I don't know if vb.net supports.  I used http://www.carlosag.net/Tools/CodeTranslator/ which should be a starting point, there may be other changes you need to do, so don't just run code through the converter and think you're done.

wilfreds replied on Friday, June 05, 2015

The telerik converter is very accurate:

Public Shared ReadOnly InvNoProperty As PropertyInfo(Of String) = RegisterProperty(Of String)(Function(t) t.InvoiceNo)
Public Property InvoiceNo() As String
    Get
        Return GetProperty(InvNoProperty)
    End Get
    Private Set
        LoadProperty(InvNoProperty, value)
    End Set
End Property

http://converter.telerik.com/

 

st3fanus replied on Saturday, June 06, 2015

thanks andy & wilfreds

could i ask another ?

Private Overrides Sub DataPortal_Fetch(orderno As String)

 

End Sub

I don't know why this code failed to replace my C# code

 

private void DataPortal_Fetch(string orderno)

{

 

}

 

thanks

Copyright (c) Marimer LLC