开发者

Creating an enum from web.config

I'd like to mimic the behavior of the "profile provider" that is available in .Net. The profile provider acquires profile properties from the web.config and those properties are immediately available as an enum for use in the code behind.

I'm unsure how to do this, and wondered whether someone may be able to help.

Essentially I'd like to allow developers to enter Role information into the web.config, and then have this role information available for use within an enum in the codebehind.

Thanks in ad开发者_开发问答vance!


I think what you're trying to do is use dynamic enums?

If so, I think you might have to consider a different implementation - enums are defined at compile-time so what you want to do isn't going to be possible using them.

A similar question was asked before: Dynamic enum in C# and it can be done, via buildproviders. But there might be another (simpler) way to achieve what you want to do ...


I haven't done this myself, but I think "build provider" is the word you're looking for... http://www.google.no/search?q=build+provider+asp.net

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜