enum datasource.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I want to bind a enum data type with XML datasource.

<?xml version="1.0" encoding="utf-8" ?>
<GlobalSettings>
<Employee>
<MinimumAge ID="10">Minimum Age</MinimumAge>
</Employee>

</GlobalSettings>

I implement this in a class:

using System;
using System.Collections.Generic;
using System.Text;

namespace test
{
class GlobalSettings
{
// here i want to call the XML file values & create the enum
definitions

}
}

In design time , I want to retreive the settings as follows:

test.GlobalSettings.Employee.MinimumAge // this will return me the ID of the
settings.

Thanks,
 
Ibrahim. said:
I want to bind a enum data type with XML datasource.

In design time , I want to retreive the settings as follows:

test.GlobalSettings.Employee.MinimumAge // this will return me the ID of the
settings.

In that case you'll need to generate source code from the XML, then
compile against it. It's not too hard to do, and you can use a pre-
build step to keep the generated source up to date.
 
Hi,

Can you give more details on how I can achieve this method.

I can generate the XML file from the tables, but how can I compile it & get
it work with enum in design mode in c#.

Thanks,
 
Ibrahim. said:
Can you give more details on how I can achieve this method.

I can generate the XML file from the tables, but how can I compile it & get
it work with enum in design mode in c#.

Don't generate an XML file from the tables - generate a C# file which
you then include in your project. Regenerate the source code whenever
your enum changes.
 
Back
Top