internal static object InternalGetInstance(SupportedTypes type, int index, ReferenceDepthContext context) { if (!context.IncreamentCounter()) { return(null); } if (type == SupportedTypes.Person) { return(new Person(index, context)); } else if (type == SupportedTypes.Employee) { return(new Employee(index, context)); } else if (type == SupportedTypes.Address) { return(new Address(index, context)); } else if (type == SupportedTypes.WorkItem) { return(new WorkItem() { EmployeeID = index, IsCompleted = false, NumberOfHours = 100, ID = 25 }); } context.DecrementCounter(); throw new ArgumentException(String.Format("Cannot initialize an instance for {0} type.", type.ToString())); }
internal static object InternalGetInstance(SupportedTypes type, int index, ReferenceDepthContext context) { if (!context.IncreamentCounter()) { return null; } if (type == SupportedTypes.Person) { return new Person(index, context); } else if (type == SupportedTypes.Employee) { return new Employee(index, context); } else if (type == SupportedTypes.Address) { return new Address(index, context); } else if (type == SupportedTypes.WorkItem) { return new WorkItem() { EmployeeID = index, IsCompleted = false, NumberOfHours = 100, ID = 25 }; } context.DecrementCounter(); throw new ArgumentException(String.Format("Cannot initialize an instance for {0} type.", type.ToString())); }