// Builds a single MasterDerived instance, returning it
        // in a collection
        private IEnumerable<AI_Master> BuildHierarchy()
        {
            int id = 0;
            AI_MasterDerived master = new AI_MasterDerived();
            master.ID = ++id;

            // Add the single-value associations
            AI_DetailDerived3 d3 = new AI_DetailDerived3()
            {
                ID = ++id,
                Master = master,
                MasterID = master.ID
            };
            master.DetailDerived3 = d3;

            AI_DetailDerived4 d4 = new AI_DetailDerived4()
            {
                ID = ++id,
                Master = master,
                MasterID = master.ID
            };
            master.DetailDerived4 = d4;

            // Add the multi-value associations
            List<AI_DetailDerived1> detailDerived1s = new List<AI_DetailDerived1>();
            List<AI_DetailDerived2> detailDerived2s = new List<AI_DetailDerived2>();

            AI_DetailDerived1 d1a = new AI_DetailDerived1()
            {
                ID = ++id,
                Master = master,
                MasterID = master.ID
            };

            AI_DetailDerived1 d1b = new AI_DetailDerived1()
            {
                ID = ++id,
                Master = master,
                MasterID = master.ID
            };
   
            AI_DetailDerived2 d2a = new AI_DetailDerived2()
            {
                ID = ++id,
                Master = master,
                MasterID = master.ID
            };
            master.DetailDerived1s = new List<AI_DetailDerived1>(new[] { d1a, d1b });
 
            AI_DetailDerived2 d2b = new AI_DetailDerived2()
            {
                ID = ++id,
                Master = master,
                MasterID = master.ID
            };
            master.DetailDerived2s = new List<AI_DetailDerived2>(new[] { d2a, d2b });

            return new AI_Master[] { master };
        }
 private bool FilterMaster(AI_MasterDerived entity)
 {
     return (entity.ID == this.MasterID);
 }
Exemple #3
0
        // Builds a single MasterDerived instance, returning it
        // in a collection
        private IEnumerable <AI_Master> BuildHierarchy()
        {
            int id = 0;
            AI_MasterDerived master = new AI_MasterDerived();

            master.ID = ++id;

            // Add the single-value associations
            AI_DetailDerived3 d3 = new AI_DetailDerived3()
            {
                ID       = ++id,
                Master   = master,
                MasterID = master.ID
            };

            master.DetailDerived3 = d3;

            AI_DetailDerived4 d4 = new AI_DetailDerived4()
            {
                ID       = ++id,
                Master   = master,
                MasterID = master.ID
            };

            master.DetailDerived4 = d4;

            // Add the multi-value associations
            List <AI_DetailDerived1> detailDerived1s = new List <AI_DetailDerived1>();
            List <AI_DetailDerived2> detailDerived2s = new List <AI_DetailDerived2>();

            AI_DetailDerived1 d1a = new AI_DetailDerived1()
            {
                ID       = ++id,
                Master   = master,
                MasterID = master.ID
            };

            AI_DetailDerived1 d1b = new AI_DetailDerived1()
            {
                ID       = ++id,
                Master   = master,
                MasterID = master.ID
            };

            AI_DetailDerived2 d2a = new AI_DetailDerived2()
            {
                ID       = ++id,
                Master   = master,
                MasterID = master.ID
            };

            master.DetailDerived1s = new List <AI_DetailDerived1>(new[] { d1a, d1b });

            AI_DetailDerived2 d2b = new AI_DetailDerived2()
            {
                ID       = ++id,
                Master   = master,
                MasterID = master.ID
            };

            master.DetailDerived2s = new List <AI_DetailDerived2>(new[] { d2a, d2b });

            return(new AI_Master[] { master });
        }