In all projects I have tables like CompanySetup or WorkstationSetup where I save user/application settings, in my VFP applications I made heavy use of the _SCREEN.oSetup or _SCREEN.oWorkstation custom properties to hold the values for those tables using the VFP command SCATTER NAME _SCREEN.oSetup.
In .NET/SF what would be the recomended way to create/have the same functionality of that data and make all those properties available anywhere in the application, like reports, forms, etc.?
Thanks!
I like the idea, specially since having the BO with strong typed properties it is easier to maintain, but in the shared class how would I loop trough the BO properties to create properties with the same name as the BO and assign their values to the newly created shared properties?
I guess so sort of reflection here should be use?
Yes, thanks. I did make sense and I got it done in no time, here is the resulting code:
Imports CardTrackingSystem.BusinessPublic MustInherit Class AppSettings Private Sub New() End Sub '-- Set the Company Setting Object Private Shared _company As bizCompany Public Shared Property Company() As bizCompany Get Return _company End Get Set(ByVal value As bizCompany) Dim loBO As New bizCompany loBO.FillAllRecords() _company = loBO End Set End Property '-- Set the Workstation Setting Object Private Shared _workstation As bizWorkstation Public Shared Property Workstation() As bizWorkstation Get Return _workstation End Get Set(ByVal value As bizWorkstation) Dim loBO As New bizWorkstation loBO.FillAllRecords() _workstation = loBO End Set End PropertyEnd Class
Imports
Public
loBO.FillAllRecords()
_company = loBO
_workstation = loBO
End
Now I can reference the properties anywhere like this:
AppSettings.Company.CompanyName = String.EmptyAppSettings.Workstation.WorkstationName = String.Empty
AppSettings.Company.CompanyName =
AppSettings.Workstation.WorkstationName =
Of course I have not tried this on reports yet, but there should be no problem