M
moondaddy
I'm wanting to use a config file to hold groups of business rules and am
thinking of using the webconfig file for this so the first question I need
to ask is: Is the webconfig file the appropriate place to do this or do I
need to create a custom config file?
The next question is how can I nest elements to contain the various
groupings and logic? for example I'm using the webconfig file already for
some very basic stuff line holding constant values the applications can use
for logic like this:
<appSettings>
<add key="ContestEndDate" value="11/08/2023 11:59:59 PM" />
<add key="EmailServer" value="192.168.100.10" />
<add key="EmailFrom" value="(e-mail address removed)" />
<add key="EmailEnabled" value="true" />
<add key="LoggingEnabled" value="true" />
<add key="RequireSSL" value="false" />
<add key="DiscountMarkForShipping" value="60" />
<add key="RunFrom" value="TestMachine_TestDB" />
<add key="StandardCacheTime" value="30" />
</appSettings>
But what I want to start doing is add an element that would contain my rules
like this
<appSettings>
<CustomAppRules>
<Rule1 someAttribute="xyz">
<SomeMoreStuff/>
</Rule1>
<Rule2>
<Condition ix="1" val="123">
<Action val="blablabla"/>
</Condition>
<Condition ix="2" val="456">
<Action val="blablabla"/>
</Condition>
</Rule2>
<CustomAppRules>
</appSettings>
Is this possible and if so, how would I access these rules and there
conditions? To access the regular stuff in the webconfig I call their
values like this:
Dim iDiscountMark As Int16 =
CType(System.Configuration.ConfigurationSettings.AppSettings("DiscountMarkFo
rShipping"), Int16)
Can I get some advice on this and also some reference material in general
about building rules engines using config files?
Thanks.
thinking of using the webconfig file for this so the first question I need
to ask is: Is the webconfig file the appropriate place to do this or do I
need to create a custom config file?
The next question is how can I nest elements to contain the various
groupings and logic? for example I'm using the webconfig file already for
some very basic stuff line holding constant values the applications can use
for logic like this:
<appSettings>
<add key="ContestEndDate" value="11/08/2023 11:59:59 PM" />
<add key="EmailServer" value="192.168.100.10" />
<add key="EmailFrom" value="(e-mail address removed)" />
<add key="EmailEnabled" value="true" />
<add key="LoggingEnabled" value="true" />
<add key="RequireSSL" value="false" />
<add key="DiscountMarkForShipping" value="60" />
<add key="RunFrom" value="TestMachine_TestDB" />
<add key="StandardCacheTime" value="30" />
</appSettings>
But what I want to start doing is add an element that would contain my rules
like this
<appSettings>
<CustomAppRules>
<Rule1 someAttribute="xyz">
<SomeMoreStuff/>
</Rule1>
<Rule2>
<Condition ix="1" val="123">
<Action val="blablabla"/>
</Condition>
<Condition ix="2" val="456">
<Action val="blablabla"/>
</Condition>
</Rule2>
<CustomAppRules>
</appSettings>
Is this possible and if so, how would I access these rules and there
conditions? To access the regular stuff in the webconfig I call their
values like this:
Dim iDiscountMark As Int16 =
CType(System.Configuration.ConfigurationSettings.AppSettings("DiscountMarkFo
rShipping"), Int16)
Can I get some advice on this and also some reference material in general
about building rules engines using config files?
Thanks.