Probably it could be an enhancement of the DDT to allow the creation and maintanance of XML files and use that metadata in the BOM, unless I am missing something here and there is something like that somewhere in the framework.
I will look at the sample and create a dummy DDT profile for the BO mapping.
But still it would be nice that from the DDT I would simple have an option to:
I know that would be a really nice feature, but probably no one that many users will actually use or need right now.
I am a bit confused here with the XML Samples and the XmlBasics classes. Here what I need:
Create an encrypted/password protected XML file to hold information about a Server Settings which will be used by a Windows Service application as implemented in your version of a Server Console explained here http://forum.strataframe.net/FindPost21316.aspx
I went to the XML Sample, but it does not used the xmlBasics classes, also I can not find information in the help file about the xmlBasics classes, so could it be possible for you to post a simple sample of a form which uses the xmlBasic classes to do the following:
If the sample can not be create at this time, could you give me some hints on how to do 1 and 2 above.
Thanks!
Public Sub FillAll() '-- Establish Locals Dim loDS As New DataSet Dim lcFile As String = MicroFour.StrataFrame.Strings.StringBasics.AddBS(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)) '-- Save the XML file to disk lcFile &= ConstantInformation.ServerSettingsXMLFileName If Not System.IO.File.Exists(lcFile) Then Me.CurrentDataTable.WriteXml(lcFile, XmlWriteMode.WriteSchema, True) End If '-- Load the XML file loDS.ReadXml(lcFile) '-- Move the data into the business object Me.CopyDataFrom(loDS.Tables(0), MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable) *-- If there is no record, add one here. If Me.Count = 0 Then Me.Add() Me.CurrentDataTable.AcceptChanges() End If '-- Clean Up loDS.Dispose()End Sub
lcFile &= ConstantInformation.ServerSettingsXMLFileName
loDS.ReadXml(lcFile)
*--
loDS.Dispose()
In my form I am able to see the data bounded to the xml file and save it back to the xml using the methods in the Sample BO to overwrite the Save() methods. I now need to add the logic to use the XmlBasics classes to take advantage of having the XML file encrypted and password protected. I am not so sure how to do this since the BO is getting the data via the loDS.ReadXml() method and that does not support the xmlBasics classes, so any help in this regard will be greatly appreciated.
Public Sub FillAllWithXMLBasics(ByVal ValidationKey As String) '-- Establish Locals Dim lcFile As String = MicroFour.StrataFrame.Strings.StringBasics.AddBS(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)) '-- Save the XML file to disk lcFile &= ConstantInformation.ServerSettingsXMLFileName '-- Get all data columns from the TableSchema in the BO ' to pass it in the xmlBasics.OpenXmlFile Dim boTableColumnArray As New List(Of DataColumn) For Each I As DataColumn In Me.CreateTableSchema boTableColumnArray.Add(I) Next '-- Load the XML file and add one row _myXMLDS = XmlBasics.OpenXmlFile("ConsoleSettings", lcFile, boTableColumnArray) If _myXMLDS.Tables("ConsoleSettings").Rows.Count = 0 Then _myXMLDS.Tables("ConsoleSettings").Rows.Add() End If '-- Move the data into the business object Me.CopyDataFrom(_myXMLDS.Tables("ConsoleSettings"), MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable) '-- In this case we need only one record so ' if there is no record, add one here. If Me.Count = 0 Then Me.Add() Me.CurrentDataTable.AcceptChanges() End IfEnd Sub
boTableColumnArray.Add(I)
_myXMLDS = XmlBasics.OpenXmlFile(
_myXMLDS.Tables(
In the above code I am not sure if I neede to create the boTableColumnArray or there is an easy way to pass the BO columns to the OpenXmlFile() method.
And to save the file from the BO to the XML I am using this method:
Private Sub SaveToXML() '-- Establish Locals Dim lcFile As String = MicroFour.StrataFrame.Strings.StringBasics.AddBS(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)) '-- Save the XML file to disk lcFile &= ConstantInformation.ServerSettingsXMLFileName '-- I am not sure if the file needs to be deleted If System.IO.File.Exists(lcFile) Then System.IO.File.Delete(lcFile) End If '-- Remove the Row created in the FillAllWithXMLBasics and import the one from the BO. '-- I guess there is probably a better way to do this? _myXMLDS.Tables("ConsoleSettings").Rows.RemoveAt(0) _myXMLDS.Tables("ConsoleSettings").ImportRow(Me.CurrentRow) '-- Write the XML file back to disk. Notice that you DO NOT NEED the validation key ' to write back to disk. This is used only for opening (and the creation of) the XML table. XmlBasics.WriteXmlFile(_myXMLDS, lcFile, False) Me.CurrentDataTable.AcceptChanges()End Sub
'-- I am not sure if the file needs to be deleted
If System.IO.File.Exists(lcFile) Then
System.IO.File.Delete(lcFile)
'-- Remove the Row created in the FillAllWithXMLBasics and import the one from the BO.
'-- I guess there is probably a better way to do this?
XmlBasics.WriteXmlFile(_myXMLDS, lcFile,
I appreciate if someone can review these code and confirm they are code appropriately.