Пример #1
0
        // <inheritdoc />
        public object GetId(object instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }
            Type      type    = instance.GetType();
            FieldMeta idField = GetIdField(type);

            return(idField.GetFieldValueFor(instance));
        }
Пример #2
0
        public EntityCopyToTarget(FieldMeta field)
        {
            _field = field;

            _action = _field.IsReadOnly
                ? (Action <object, object>)((s, d) =>
            {
                var dest = field.GetFieldValueFor(d);
                Copier.Copy(s, dest);
            })
                : (Action <object, object>)((s, d) =>
            {
                var copy = Copier.Copy(s);
                _field.SetFieldValueOf(d, copy);
            });
        }
Пример #3
0
        public override void Copy(object source, object destination)
        {
            var value = _field.GetFieldValueFor(source);

            _field.SetFieldValueOf(destination, value);
        }
Пример #4
0
        public override void Copy(object source, object destination)
        {
            var value = _field.GetFieldValueFor(source);

            _action(value, destination);
        }