Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User Defined Settings for the Business Objects
Message
From
02/02/2011 11:47:00
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
02/02/2011 10:02:29
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01498282
Message ID:
01498323
Views:
43
>>>>>Hi,
>>>>>
>>>>>using ASP.NET, C#, MM.NET 3,6 and VS 2008.
>>>>>
>>>>>I need to let the user define some values which will be made use of by the Business Object code. I have a Settings file and class that work for a config file in my web/UI, but what do I do for the BO? Do I use the app.config file? Do I create my own My.config? Or should I use a table to store the values and create a BO that accesses this table?
>>>>
>>>>Using a table is a good approach for application settings. I am not sure I understand the question "What do I do for the BO?" Have you checked out the Dev Guid topic on Overview of MM.Net / Application Settings Classes ? I typically create a subclass of mmAppConfiguration for application level settings. With Web stuff however, I don't like to put stuff in the Web.Config and writing to files can be a question so using the database approach if a very good one.
>>>>Tim
>>>
>>>Hi Tim,
>>>
>>>what I meant by "What do I do for the BO?" is that so far I've been using the settings class that you gave me that is part of the web project and writes to my settings file, but now I need to access various settings that are only applicable in the BO project.
>>
>>Ah, got it. Are these such that you can pass the values in from the application when you call those methods on the business object? Are we talking lots of settings or are they used in most business objects? There are other more complex options if that is the case. We can explore that based on your answer.
>>Tim
>
>These are three or four user defined values that one particular BO will use, however I need to provide a web page to let the user set the values. I suppose I could pass them into the BO method that needs them, but that doesn't feel right.

Hi Frank,
Application settings are typically a function of the application and not really the data layer. Not strictly the case however and depends on what the settings are. If the user has the ability to set these and save them, then I would put them in a database and create a business object for the settings. This would give you the ability to have a business object, get and save the settings in a user interface as well as access them via another business object. You could also put them in an xml file and still have a business object and entity that goes with them. If you create an entity, they can be serialized to save it as an XML. Might just depend on your needs. Will different users have different settings? If so, go with the database approach. If these are global settings, then go with the xml or serialized entity (xml) approach. Depending on what they are, I would really look hard at putting them in the application. Then it is a question of how to get those to your business object. As I said before there are ways to do that other than passing as arguments. If many methods in the business object need those settings, then might want them set as properties of the BO when it is instantiated.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform