PwrDev makes it possible to use .NET functionality.
The easiest to do this is to make use of a custom written class which exposes a few PowerBASIC 'friendly' methods and properties.
It's nearly impossible to use the different vartypes of .NET directly.
Therefore it's easier to use a custom assembly and expose variables PowerBASIC can use, a wrapper.
An assembly is a dll but can not be called as generic win32 library.
PwrDev can load this library for you and by specifying the classname it will return a late bound dispatch object with an instance of your custom class.
And all this without registrering the assembly on the target computer and if desired.. the assembly can be fully embedded in the applications memory and does not need to be saved to disk before use.
This is a native .NET feature and thus safe.
The assembly should contain one or more ordinary dynamic classes but does not need to be prepared with specific attributes like com exposure or whatsoever.
This is all handled by the .NET common language runtime.
For me one of the better parts of .NET is it's stability, .NET never seems to crash or have unpredictable results.
Another good thing is the availability of the functionality.
ADO.NET and webservices are most important to me and since this week i have added this XML reader assembly.
It is represented by a com interface, see the simple example below.
I hope i can convince you that even if you prefer to use ordinary MDAC stuff for database and so on that this .NET code is a good backup feature.
In our software we treat it this way, if .NET is not installed on the client's computer we try to use the ordinary parts.
And.. do note that calling ASP.NET webservices is now equally easy.
A simple call to wsdl.exe creates a class, optionally combine and compile these with several other custom classes into one assembly and your are ready to go!
XML reader example:
The easiest to do this is to make use of a custom written class which exposes a few PowerBASIC 'friendly' methods and properties.
It's nearly impossible to use the different vartypes of .NET directly.
Therefore it's easier to use a custom assembly and expose variables PowerBASIC can use, a wrapper.
An assembly is a dll but can not be called as generic win32 library.
PwrDev can load this library for you and by specifying the classname it will return a late bound dispatch object with an instance of your custom class.
And all this without registrering the assembly on the target computer and if desired.. the assembly can be fully embedded in the applications memory and does not need to be saved to disk before use.
This is a native .NET feature and thus safe.
The assembly should contain one or more ordinary dynamic classes but does not need to be prepared with specific attributes like com exposure or whatsoever.
This is all handled by the .NET common language runtime.
For me one of the better parts of .NET is it's stability, .NET never seems to crash or have unpredictable results.
Another good thing is the availability of the functionality.
ADO.NET and webservices are most important to me and since this week i have added this XML reader assembly.
It is represented by a com interface, see the simple example below.
I hope i can convince you that even if you prefer to use ordinary MDAC stuff for database and so on that this .NET code is a good backup feature.
In our software we treat it this way, if .NET is not installed on the client's computer we try to use the ordinary parts.
And.. do note that calling ASP.NET webservices is now equally easy.
A simple call to wsdl.exe creates a class, optionally combine and compile these with several other custom classes into one assembly and your are ready to go!
XML reader example:
Code:
[color=#0000FF]Function[/color] Test() [color=#0000FF]As[/color] [color=#0000FF]Long[/color] [color=#0000FF]Local[/color] oNodeList [color=#0000FF]As[/color] [color=#0000FF]VD_CLR_XML_INodeList[/color] [color=#0000FF]Local[/color] oNode [color=#0000FF]As[/color] [color=#0000FF]VD_CLR_XML_INode[/color] [color=#0000FF]Local[/color] oAttributes [color=#0000FF]As[/color] [color=#0000FF]VD_CLR_XML_IAttributes[/color] [color=#0000FF]Local[/color] oNodeAttrib [color=#0000FF]As[/color] [color=#0000FF]VD_CLR_XML_INode[/color] [color=#0000FF]Local[/color] nCount [color=#0000FF]As[/color] [color=#0000FF]Long[/color] [color=#0000FF]Local[/color] nItem [color=#0000FF]As[/color] [color=#0000FF]Long[/color] [color=#0000FF]Local[/color] T [color=#0000FF]As[/color] [color=#0000FF]String[/color] VD_CLR_XML_Document_CreateObject( oXMLDoc ) [color=#0000FF]If[/color] oXMLDoc.Load( "{APP_PATH_PROJECT}..\App_Data\5_2007.xml" ) [color=#0000FF]Then[/color] oNodeList = oXMLDoc.SelectNodes( "auditfile/transactions/journal/transaction/line" ) [color=#0000FF]If[/color] [color=#0000FF]IsObject[/color]( oNodeList ) [color=#0000FF]Then[/color] nCount = oNodeList.Count [color=#0000FF]For[/color] nItem = 0 [color=#0000FF]To[/color] nCount - 1 oNode = oNodeList.Item( nItem ) T = [color=#0000FF]Format$[/color]( nItem, "00" ) _ & ", " & oNode.SelectSingleNode( "accountID" ).InnerText _ & ", " & oNode.SelectSingleNode( "description" ).InnerText _ & ", " & oNode.SelectSingleNode( "debitAmount" ).InnerText _ & ", " & oNode.SelectSingleNode( "creditAmount" ).InnerText [color=#0000FF]VD_Debug_Print[/color] T [color=#0000FF]Next[/color] [color=#0000FF]MsgBox[/color] [color=#0000FF]Format$[/color]( nCount ) [color=#0000FF]End[/color] [color=#0000FF]If[/color] [color=#0000FF]End[/color] [color=#0000FF]If[/color] [color=#0000FF]End[/color] [color=#0000FF]Function[/color]