Skip to content

Instantly share code, notes, and snippets.

@fferegrino
Created September 15, 2015 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fferegrino/a81cd436e4d631f1cf4d to your computer and use it in GitHub Desktop.
Save fferegrino/a81cd436e4d631f1cf4d to your computer and use it in GitHub Desktop.
Post de alias creados por el usuario
using System;
using Ents = MyApp.DataAccess.Entities;
using Edt = MyApp.ViewModels.Editable;
public class Test
{
public static void Main()
{
Edt.Person person =
new Edt.Person { Name = "Verde Valle" };
var otherPerson = MapPerson(person);
Console.WriteLine(otherPerson.Name);
}
public static Ents.Person MapPerson(Edt.Person person)
{
Ents.Person p = new Ents.Person { Name = person.Name };
return p;
}
}
namespace MyApp.DataAccess.Entities
{
public class Person
{
public string Name { get; set; }
}
}
namespace MyApp.ViewModels.Editable
{
public class Person
{
public string Name { get; set; }
}
}
using System;
using EntityPerson = MyApp.DataAccess.Entities.Person;
using EditablePerson = MyApp.ViewModels.Editable.Person;
public class Test
{
public static void Main()
{
EditablePerson person =
new EditablePerson { Name = "Verde Valle" };
var otherPerson = MapPerson(person);
Console.WriteLine(otherPerson.Name);
}
public static EntityPerson MapPerson(EditablePerson person)
{
EntityPerson p = new EntityPerson { Name = person.Name };
return p;
}
}
namespace MyApp.DataAccess.Entities
{
public class Person
{
public string Name { get; set; }
}
}
namespace MyApp.ViewModels.Editable
{
public class Person
{
public string Name { get; set; }
}
}
using System;
public class Test
{
public static void Main()
{
MyApp.ViewModels.Editable.Person person =
new MyApp.ViewModels.Editable.Person { Name = "Verde Valle" };
var otherPerson = MapPerson(person);
Console.WriteLine(otherPerson.Name);
}
public static MyApp.DataAccess.Entities.Person MapPerson(MyApp.ViewModels.Editable.Person person)
{
MyApp.DataAccess.Entities.Person p =
new MyApp.DataAccess.Entities.Person { Name = person.Name };
return p;
}
}
namespace MyApp.DataAccess.Entities
{
public class Person
{
public string Name { get; set; }
}
}
namespace MyApp.ViewModels.Editable
{
public class Person
{
public string Name { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment