Date: 03/24/05 (Asp Dot Net) Keywords: database, asp I'm about to start a new ASP.NET project and one thing I'd like to find is a way to do is automate the export of static constants to a text file. The text will ultimately be used when building the database tables and stored procs. The goal here is to make sure constants get defined in only one place. For example letus say I have a set of classes like I when I finish a build I'd like to have a text file that would look something like this:public class FilterTypes { public enum Categories { cero, uno, dos, tres, quatro }; } public class UserModes { public static readonly int mask1 = 1; public static readonly int mask2 = 2; public static readonly int mask3 = 4; public static readonly int mask4 = 8; } public sealed MyKingdomForAClassName { private static int _hidden = 13; static public int Hidden { get { return _hidden; } } } I've managed to write some methods that using IReflection to get these values. But the question is what is the best way to call all these at the end of the build. Or is there a better way to approach this. Anybody have any experience centralizing constants definitions in .NET?Test1.Data.FilterTypes.mask1 = 1 Test1.Data.UserModes.mask2 = 2 Test1.Data.UserModes.mask3 = 4 Test1.Data.UserModes.mask4 = 8 Test1.Data.MyKingdomForAClassName.Hidden = 13 Test1.Data.FilterTypes.Categories.cero = 0 Test1.Data.FilterTypes.Categories.uno = 1 Test1.Data.FilterTypes.Categories.dos = 2 Test1.Data.FilterTypes.Categories.tres = 3 Test1.Data.FilterTypes.Categories.quatro = 4 Source: http://www.livejournal.com/community/aspdotnet/29556.html
|