Exemple #1
0
        public void UpdateEntitiesWithManyToManyRelationship()
        {
            InsertEntitiesWithManyToManyRelationship();

            var disconnectedUpdateMapper = new DisconnectedUpdateMapper();

            var principalEntityByConventionMTM = new PrincipalEntityByConventionMTM()
            {
                FirstProperty  = 200,
                SecondProperty = "another entity"
            };

            var dependentEntityByConventionMTM = new DependentEntityByConventionMTM()
            {
                FirstProperty  = 200,
                SecondProperty = 13.78m
            };

            new DisconnectedInsertMapper().InsertEntitiesWithoutRelationship(principalEntityByConventionMTM, dependentEntityByConventionMTM);

            var middleEntityByConventionMTM = new MiddleEntityByConventionMTM()
            {
                Id = 1,
                PrincipalEntityByConventionMTMId = 1,
                DependentEntityByConventionMTMId = 2
            };

            disconnectedUpdateMapper.UpdateEntitiesWithManyToManyRelationship(middleEntityByConventionMTM);
        }
Exemple #2
0
        public void UpdateEntitiesWithOneToOneRelationship()
        {
            InsertEntitiesWithOneToOneRelationship();

            var disconnectedUpdateMapper = new DisconnectedUpdateMapper();

            var firstPrincipalEntityByConventionOTO = new PrincipalEntityByConventionOTO()
            {
                Id             = 1,
                FirstProperty  = 100,
                SecondProperty = "example that will update the entities",
                DependentEntityByConventionOTO = new DependentEntityByConventionOTO()
                {
                    FirstProperty = 85, SecondProperty = 55.22m
                }
            };

            disconnectedUpdateMapper.UpdateEntitiesWithOneToOneRelationship(firstPrincipalEntityByConventionOTO);
        }
Exemple #3
0
        public void UpdateEntitiesWithOneToManyRelationship()
        {
            InsertEntitiesWithOneToManyRelationship();

            var disconnectedUpdateMapper = new DisconnectedUpdateMapper();

            var firstPrincipalEntityByConventionOTM = new PrincipalEntityByConventionOTM()
            {
                Id             = 1,
                FirstProperty  = 100,
                SecondProperty = "example that will update the entities",
                DependentsEntitiesByConventionOTM = new List <DependentEntityByConventionOTM>()
                {
                    new DependentEntityByConventionOTM()
                    {
                        Id = 1, FirstProperty = 50, SecondProperty = 12.45m
                    }
                }
            };

            disconnectedUpdateMapper.UpdateEntitiesWithOneToManyRelationship(firstPrincipalEntityByConventionOTM);
        }