Пример #1
0
        internal static object CopyInternal(object source, object dest, TypeAccessor ta)
        {
            bool isDirty = false;
            IMemberwiseEditable sourceEditable = source as IMemberwiseEditable;
            IMemberwiseEditable destEditable   = dest   as IMemberwiseEditable;

            if (sourceEditable != null && destEditable != null)
            {
                foreach (MemberAccessor ma in ta)
                {
                    ma.CloneValue(source, dest);
                    if (sourceEditable.IsDirtyMember(null, ma.MemberInfo.Name, ref isDirty) && !isDirty)
                    {
                        destEditable.AcceptMemberChanges(null, ma.MemberInfo.Name);
                    }
                }
            }
            else
            {
                foreach (MemberAccessor ma in ta)
                {
                    ma.CloneValue(source, dest);
                }
            }

            return(dest);
        }
Пример #2
0
        internal static object CopyInternal(object source, object dest, TypeAccessor ta)
        {
            bool isDirty = false;
            IMemberwiseEditable sourceEditable = source as IMemberwiseEditable;
            IMemberwiseEditable destEditable   = dest   as IMemberwiseEditable;

            if (sourceEditable != null && destEditable != null)
            {
                foreach (MemberAccessor ma in ta)
                {
                    // BVChanges: XmlIgnoreAttribute && RelationAttribute
                    if (ma.GetAttribute <System.Xml.Serialization.XmlIgnoreAttribute>() == null)
                    {
                        ma.CloneValue(source, dest);
                        if (sourceEditable.IsDirtyMember(null, ma.MemberInfo.Name, ref isDirty) && !isDirty)
                        {
                            destEditable.AcceptMemberChanges(null, ma.MemberInfo.Name);
                        }
                    }
                }
            }
            else
            {
                foreach (MemberAccessor ma in ta)
                {
                    // BVChanges: XmlIgnoreAttribute && RelationAttribute
                    if (ma.GetAttribute <System.Xml.Serialization.XmlIgnoreAttribute>() == null)
                    {
                        ma.CloneValue(source, dest);
                    }
                }
            }

            return(dest);
        }