コード例 #1
0
        internal static void UpdateEmployee(this ReverseMapper mapper, Employee source, Sample.Business.Employee target)
        {
            // Verify null args:
            if (Object.ReferenceEquals(source, null))
            {
                return;
            }
            else if (Object.ReferenceEquals(target, null))
            {
                throw new Max.Domain.Mapping.MappingException("No target provided to map Employee on.");
            }

            // Map source to target:
            mapper.UpdateSystemObject(source, target);
            if (target.EmployeeID != source.Id)
            {
                target.EmployeeID = source.Id;
            }
            if (target.Gender != source.Gender)
            {
                target.Gender = (String.IsNullOrWhiteSpace(source.Gender)) ? null : source.Gender.Trim();
            }
            if (target.BirthDate != source.BirthDate)
            {
                target.BirthDate = source.BirthDate;
            }
            if (target.HireDate != source.HireDate)
            {
                target.HireDate = source.HireDate;
            }
            if (target.ManagerID != source.ManagerId)
            {
                target.ManagerID = source.ManagerId;
            }

            // Call partial AfterUpdate method:
            AfterUpdateEmployee(mapper, source, target);
        }
コード例 #2
0
 public static void UpdateBaseObject(this ReverseMapper mapper, object source, object target)
 {
     mapper.UpdateSystemObject(source, target);
 }