To be more clear, I give an example
I have a class which is responsible with sql queries. Of course, I have more domains/fields and more queries.
I want to separate them by fields to be easily used by other programmers.
So the class
public static class QueryClass
{
public static class Field1
{
public static string AQuery { get { return "a"; } }
public static string BQuery { get { return "b"; } }
}
public static class Field2
{
public static string AQuery { get { return "a1"; } }
public static string BQuery { get{ return "b1"; } }
}
}
Example, how to use:
string aSimpleQueryField1 = QueryClass.Field1.AQuery;
string aSimpleQueryField2 = QueryClass.Field2.AQuery;
It’s a good idea to use nested class ? Or is another best way ?
Don’t see any problem with this, actually think this is a good idea, especially from coding point of view. If you have different queries for different data, it would be intuitive enough to have:
QueryBase..QueryUserInfo.Something()orQueryBase.QueryStats.Something()