Last active
September 1, 2016 02:31
-
-
Save Layoric/12ff6d11d909412f8f29006386b8789e to your computer and use it in GitHub Desktop.
Auto mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using ServiceStack; | |
using ServiceStack.Text; | |
public class GetPersonResponse | |
{ | |
public string FirstName { get;set; } | |
public string LastName { get;set; } | |
public int Age { get;set; } | |
} | |
public class Person | |
{ | |
public string FirstName { get;set; } | |
public string LastName { get;set; } | |
public int Age { get;set; } | |
} | |
var person = new Person { | |
FirstName = "Bob", | |
LastName = "Smith", | |
Age = 40 | |
}; | |
var personResponse = person.ConvertTo<GetPersonResponse>(); | |
Console.WriteLine(personResponse.GetType().Name); | |
personResponse.PrintDump(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="ServiceStack.Text" version="4.0.62" targetFramework="net45" /> | |
<package id="ServiceStack.Client" version="4.0.62" targetFramework="net45" /> | |
<package id="ServiceStack.Interfaces" version="4.0.62" targetFramework="net45" /> | |
</packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment