示例#1
0
 public LevelsEntitiesController()
 {
     Entities = new List <LevelsEntity>();
     for (int i = 1; i <= 10; i++)
     {
         if (i % 2 == 1)
         {
             var newEntity = new LevelsEntity
             {
                 ID           = i,
                 Name         = "Name " + i,
                 Parent       = Entities.LastOrDefault(),
                 BaseEntities = Entities.Concat(new[]
                 {
                     new LevelsBaseEntity
                     {
                         ID   = i + 10,
                         Name = "Name " + (i + 10)
                     }
                 }).ToArray(),
                 DerivedAncestors = Entities.OfType <LevelsDerivedEntity>().ToArray()
             };
             Entities.Add(newEntity);
         }
         else
         {
             var newEntity = new LevelsDerivedEntity
             {
                 ID           = i,
                 Name         = "Name " + i,
                 DerivedName  = "DerivedName " + i,
                 Parent       = Entities.LastOrDefault(),
                 BaseEntities = Entities.Concat(new[]
                 {
                     new LevelsBaseEntity
                     {
                         ID   = i + 10,
                         Name = "Name " + (i + 10)
                     }
                 }).ToArray(),
                 DerivedAncestors         = Entities.OfType <LevelsDerivedEntity>().ToArray(),
                 AncestorsInDerivedEntity = Entities.ToArray()
             };
             Entities.Add(newEntity);
         }
     }
     Entities[8].Parent           = Entities[9];
     Entities[1].DerivedAncestors = new LevelsDerivedEntity[] { (LevelsDerivedEntity)Entities[3] };
 }
示例#2
0
 public LevelsEntitiesController()
 {
     Entities = new List<LevelsEntity>();
     for (int i = 1; i <= 10; i++)
     {
         if (i % 2 == 1)
         {
             var newEntity = new LevelsEntity
             {
                 ID = i,
                 Name = "Name " + i,
                 Parent = Entities.LastOrDefault(),
                 BaseEntities = Entities.Concat(new[]
                     {
                         new LevelsBaseEntity
                         {
                             ID = i + 10,
                             Name = "Name " + (i + 10)
                         }
                     }).ToArray(),
                 DerivedAncestors = Entities.OfType<LevelsDerivedEntity>().ToArray()
             };
             Entities.Add(newEntity);
         }
         else
         {
             var newEntity = new LevelsDerivedEntity
             {
                 ID = i,
                 Name = "Name " + i,
                 DerivedName = "DerivedName " + i,
                 Parent = Entities.LastOrDefault(),
                 BaseEntities = Entities.Concat(new[]
                     {
                         new LevelsBaseEntity
                         {
                             ID = i + 10,
                             Name = "Name " + (i + 10)
                         }
                     }).ToArray(),
                 DerivedAncestors = Entities.OfType<LevelsDerivedEntity>().ToArray(),
                 AncestorsInDerivedEntity = Entities.ToArray()
             };
             Entities.Add(newEntity);
         }
     }
     Entities[8].Parent = Entities[9];
     Entities[1].DerivedAncestors = new LevelsDerivedEntity[] { (LevelsDerivedEntity)Entities[3] }; 
 }