Inspecting the generated solution
By default, the QuickStart will automatically open the generated Visual Studio solution. If this does not happen, you will need to open the generated solution. The solution will be located in the directory you specified in the QuickStart's Location property.
Once the generated Visual Studio solution is opened, you will need to build the solution to see the generated code as shown in the image below.
CodeSmith Generator uses the Entities.csp Generator Project File (CSP) to generate code for your project. This file is created by the QuickStart with all of your information pre-populated from the previous step. Generator is smart enough to figure out if you have already configured the Entities CSP file. If you haven't, Generator will automatically try to resolve the correct business object types (E.G., Criteria, EditableRoot, EditableRootList...) to generate based off of your database relationships. The generated code will be separated into multiple folders.
Folder Name | Description |
---|---|
Collections | Contains all non-collection business object types. |
Commands | Contains the data access implementation. |
Criteria | Contains properties, factory methods and required rules. |
Entities | Contains all non-collection business object types. |
Utility | Contains any utilities classes that may be used by the generated code. |
For the simplicity of this walk through, I'll choose to talk about the Category business object. The Category business object is shown in the image above. As you might have noticed, there are multiple files for the Category business object. These files are called partial classes, which allows us to separate the different responsibilities of a business object.
Partial Class File Name | Editable | Description |
---|---|---|
Category.cs | Yes | Contains all of your custom code. |
Category.DataAccess.cs | No | Contains the data access implementation. |
Category.Generated.cs | No | Contains properties, factory methods and required rules. |
In the next step, we will cover how to configure Category's business object type.