Exemple #1
0
        private void CopyFieldValuesAcross(object src, object dest, IReflectClass claxx,
                                           IReplicationProviderInside sourceProvider, IReplicationProviderInside targetProvider
                                           )
        {
            if (dest == null)
            {
                throw new InvalidOperationException("Dest cannot be null: src=" + src + ", class="
                                                    + claxx + ", source=" + sourceProvider.GetName() + ", target=" + targetProvider
                                                    .GetName());
            }
            IEnumerator fields = FieldIterators.PersistentFields(claxx);

            while (fields.MoveNext())
            {
                IReflectField field = (IReflectField)fields.Current;
                object        value = field.Get(src);
                field.Set(dest, FindCounterpart(value, sourceProvider, targetProvider));
            }
            IReflectClass superclass = claxx.GetSuperclass();

            if (superclass == null)
            {
                return;
            }
            CopyFieldValuesAcross(src, dest, superclass, sourceProvider, targetProvider);
        }
Exemple #2
0
        private void CopyFieldValuesAcross(object src, object dest, IReflectClass claxx,
                                           IReplicationProviderInside sourceProvider, IReplicationProviderInside targetProvider
                                           )
        {
            IEnumerator fields = FieldIterators.PersistentFields(claxx);

            while (fields.MoveNext())
            {
                IReflectField field = (IReflectField)fields.Current;
                object        value = field.Get(src);
                field.Set(dest, FindCounterpart(value, sourceProvider, targetProvider));
            }
            IReflectClass superclass = claxx.GetSuperclass();

            if (superclass == null)
            {
                return;
            }
            CopyFieldValuesAcross(src, dest, superclass, sourceProvider, targetProvider);
        }