Now it is time to generate some business entities from a model.
Suppose we have a simplified model with just one entity called Course. It has an unique identifier CourseID and a searchable and displayable attribute called CourseName.
To generate source code the model is injected into the following template.
The resulting generated code will look like this:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
public class Course { public int m_CourseID; public string m_CourseName; public int CourseID { get { return m_CourseID; } set { if (value != m_CourseID) { m_CourseID = value; } } } public string CourseName { get { return m_CourseName; } set { if (value != m_CourseName) { m_CourseName = value; } } } } |
That’s all.
Comments