// Methods protected override object CreateEntity() { // SubEntityGroupName string subEntityGroupName = this.SubEntityGroupName; if (string.IsNullOrEmpty(subEntityGroupName) == true) throw new InvalidOperationException(); // SubEntity SubEntity subEntity = this.ReflectContext.CreateEntity<SubEntity>(subEntityGroupName); if (subEntity == null) throw new InvalidOperationException(); // Create TopEntity topEntity = new TopEntity(subEntity); // Return return topEntity; }
static void Main(string[] args) { // Create ReflectContext reflectContext = Program.Create(); // CreateEntity TopEntity topEntity = reflectContext.CreateEntity <TopEntity>("TopEntityGroup"); // Print Console.WriteLine("\nTopEntity.SubEntity.Print()"); topEntity.SubEntity.Print(); // End Console.WriteLine("\nPress enter to end..."); Console.ReadLine(); }
// Methods protected override object CreateEntity() { // SubEntityGroupName string subEntityGroupName = this.SubEntityGroupName; if (string.IsNullOrEmpty(subEntityGroupName) == true) { throw new InvalidOperationException(); } // SubEntity SubEntity subEntity = this.ReflectContext.CreateEntity <SubEntity>(subEntityGroupName); if (subEntity == null) { throw new InvalidOperationException(); } // Create TopEntity topEntity = new TopEntity(subEntity); // Return return(topEntity); }