I have created a code generator for our project to generate a lot of our crud operations, and basic dataAccess objects for our database. (we aren’t using some other tools because we aren’t allowed to execute dynamic sql and are only allowed stored procs).
The thing I am thinking about right now is that we have ~1,200 tables. I don’t want to include every table object into our project (not until it is actually going to be used).
My objects contain a property that references other objects (like a parent/child relationship).
Say I have my 2 objects (they are in different files)
public class ClassA{
public ClassB GetClassBforA{get;set;}
//Lost of other properties and code
}
public class ClassB{/* bunch of stuff*/}
Now I know no one is currently using ClassB, and I don’t want to include in our project (yet) because it has many references to other classes and tools. I would like the property on ClassA to not be compiled. (since this file is automatically generated it is bound to be over written)
I was thinking of maybe something like this
public class ClassA{
#if ClassBIsDefind
public ClassB GetClassBforA{get;set;}
#endif
//Lost of other properties and code
}
#define ClassBIsDefind
public class ClassB{/* bunch of stuff*/}
But this doesn’t work because ClassBIsDefind is set in another file.
Is there another way to do this?
You can define conditional code compilation symbols in the Build tab of the project properties page in Visual Studio, or with a command line switch if you invoke the compiler at the command line. These symbols are available to all files.