Release Notes

If you don't already have a reference to FlitBit Copy add one using the NuGet command line:

PM> Install-Package FlitBit.Copy

Summary

FlitBit Copy is a small library for copying values from one object to another. It emits optimized code at runtime that performs the property-pushing grunt-work so that your code remains semantically simple.

Overview

FlitBit Copy's single purpose is to make copying data from one object to another as simple as can be. It implements loose and strict copiers so you can easily translate between models.
  • Loose -- the structure of the source and target objects can be dissimilar.
  • Strict -- every property of the source must be assignable to a similarly named property on the target.

In most cases you can just take what you have and copy it onto what you want.

// assume:

public class Want { public string Things { get; set; } }

// ... and:

var have = new { Things = "three beans" };

// ... then you can:

var want = have.CopyTo(new Want());

// ... or ...

var want = new Want().CopyFrom(have);

// ... or ...

var want = Copier<Want>.CopyConstruct(have);

// ... and the result is:

Assert.AreEqual("three beans", want.Things);

Other Useful Frameworks

Visit the Core library's page to learn more about the FlitBit Frameworks.

After I get the other frameworks published I'll make another pass and document the interesting parts of this library.

Build Requirements
Some of the command lines rely on Powershell. Ensure your execution policy is permissive enough if you run the batch files or powershells.

~P

Last edited Mar 29, 2013 at 4:26 PM by cerebralkungfu, version 11