AnyClone icon indicating copy to clipboard operation
AnyClone copied to clipboard

AutoMapper vs AnyClone

Open sigmarsson opened this issue 4 years ago • 1 comments

It is merely a question rather than a bug or issue.

Is AnyClone preferred over AutoMapper.Map<T, T>() method ? Without being too specific.

And being a little more; do you actually handle anytihing special around properties like ;

        [BsonId]
        public long Id { get; set; }

sigmarsson avatar Feb 25 '21 19:02 sigmarsson

They aren't functionally much different. AutoMapper can implicitly map without a mapping definition. If the object types are different, but have the same names it can also clone from one to another. Essentially, this is cloning an object's contents (private fields, properties, collections etc). AnyClone utilizes reflection to copy an object's contents recursively including some hairy details that are needed to clone more complex structures and it's fairly efficient.

Performance wise, it's about the same as AutoMapper. Similarly I have another package called AnySerializer which instead of copying using reflection it serializes the data to a byte structure (similar to Protobuf) but does so without any decorative attributes and can handle a wide range of complex objects.

replaysMike avatar Feb 26 '21 23:02 replaysMike