enum datasource.

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,
 
J

Jon Skeet [C# MVP]

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.
 
G

Guest

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,
 
J

Jon Skeet [C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top