Game Development Reference
In-Depth Information
By referencing the object model assembly in the CodeDom instance, we can now
execute any code in the command window that can be expressed in the compiled
code for the application that uses the object model.
Simple Automation and MVC Example
The previous section gave a quick inside look at the example for this chapter, and
now we are going to dive right into the heart of everything. We are going to make
an application that serves no real world applicability, but it demonstrates all of the
concepts discussed in this chapter. To start, we are going to need some sort of data
object to exist in our model, so let's declare the following entity class.
namespace SampleApp.Entities
{
public class SimpleEntity
{
Note
The full source code for this class is available on the Companion Web site.
}
}
Note
The full source code for the example will not be presented, so it may be difficult to see how the
assemblies are composed and where each class belongs. It is safe to assume that whatever name-
space a class is declared in is also the name of the assembly in which it resides.
Before covering the event system for our object model, we will need a custom
EventArgs class that can store a SimpleEntity object. This class will be used to trans-
port entity data between views and the controller inside the events.
The following code defines the EventArgs class for SimpleEntity events.
namespace SampleApp.Entities
{
public class SimpleEntityEventArgs : EventArgs
{
Note
The full source code for this class is available on the Companion Web site.
 
Search Nedrilad ::




Custom Search