public static SetOfGenericPolymorph Create(int id) { Random rnd = new Random(); return(new SetOfGenericPolymorph() { Id = id, Set = new List <MappedObjectGeneric <PolymorphicBaseClass> > () { MappedObjectGeneric <PolymorphicBaseClass> .Create(1, PolymorphicBaseClass.Create(10)), MappedObjectGeneric <PolymorphicBaseClass> .Create(2, PolymorphicSubClass.Create(11)), MappedObjectGeneric <PolymorphicBaseClass> .Create(3, PolymorphicSubSubClass.Create(12)) } }); }