public static void MapTo(this IStudentSchoolAssociation source, IStudentSchoolAssociation target, Action <IStudentSchoolAssociation, IStudentSchoolAssociation> onMapped)
        {
            var sourceSynchSupport = source as IStudentSchoolAssociationSynchronizationSourceSupport;
            var targetSynchSupport = target as IStudentSchoolAssociationSynchronizationSourceSupport;

            // Copy resource Id
            target.Id = source.Id;

            // Copy contextual primary key values
            target.SchoolName         = source.SchoolName;
            target.StudentFirstName   = source.StudentFirstName;
            target.StudentLastSurname = source.StudentLastSurname;

            // Copy non-PK properties

            // Copy Aggregate Reference Data
            if (GeneratedArtifactStaticDependencies.AuthorizationContextProvider == null ||
                GeneratedArtifactStaticDependencies.AuthorizationContextProvider.GetAction() == RequestActions.ReadActionUri)
            {
                target.SchoolResourceId     = source.SchoolResourceId;
                target.SchoolDiscriminator  = source.SchoolDiscriminator;
                target.StudentResourceId    = source.StudentResourceId;
                target.StudentDiscriminator = source.StudentDiscriminator;
            }



            // ----------------------------------
            //   Map One-to-one relationships
            // ----------------------------------

            // Map lists


            var eTagProvider = new ETagProvider();

            // Convert value to ETag, if appropriate
            var entityWithETag = target as IHasETag;

            if (entityWithETag != null)
            {
                entityWithETag.ETag = eTagProvider.GetETag(source);
            }

            // Convert value to LastModifiedDate, if appropriate
            var dateVersionedEntity = target as IDateVersionedEntity;
            var etagSource          = source as IHasETag;

            if (dateVersionedEntity != null && etagSource != null)
            {
                dateVersionedEntity.LastModifiedDate = eTagProvider.GetDateTime(etagSource.ETag);
            }
        }
        public static bool SynchronizeTo(this IStudentSchoolAssociation source, IStudentSchoolAssociation target)
        {
            bool isModified = false;

            var sourceSupport = source as IStudentSchoolAssociationSynchronizationSourceSupport;

            // Allow PK column updates on StudentSchoolAssociation
            if (
                (target.SchoolName != source.SchoolName) ||
                (target.StudentFirstName != source.StudentFirstName) ||
                (target.StudentLastSurname != source.StudentLastSurname))
            {
                isModified = true;

                var sourceWithPrimaryKeyValues = (source as IHasPrimaryKeyValues);

                if (sourceWithPrimaryKeyValues != null)
                {
                    var targetWithNewKeyValues = target as IHasCascadableKeyValues;

                    if (targetWithNewKeyValues != null)
                    {
                        targetWithNewKeyValues.NewKeyValues = sourceWithPrimaryKeyValues.GetPrimaryKeyValues();
                    }
                }
            }

            // Back synch non-reference portion of PK (PK properties cannot be changed, therefore they can be omitted in the resource payload, but we need them for proper comparisons for persistence)
            if (source.SchoolName != target.SchoolName)
            {
                source.SchoolName = target.SchoolName;
            }
            if (source.StudentFirstName != target.StudentFirstName)
            {
                source.StudentFirstName = target.StudentFirstName;
            }
            if (source.StudentLastSurname != target.StudentLastSurname)
            {
                source.StudentLastSurname = target.StudentLastSurname;
            }

            // Copy non-PK properties


            // Sync lists

            return(isModified);
        }