Пример #1
0
        public static Person ToPerson(this DbPerson person)
        {
            var adapter = new DbPersonAdapter(person);

            return(new Person()
            {
                Name = adapter.Name, Age = adapter.Age
            });
        }
Пример #2
0
        public static void Execute()
        {
            var dbPerson = new DbPerson
            {
                FirstName = "Adam",
                LastName  = "Adamski",
                BirthDate = new DateTime(1982, 2, 12)
            };

            ToString(new DbPersonAdapter(dbPerson));
            ToString(PersonAdaptation.ToPerson(dbPerson));
            ToString(dbPerson.ToPerson());
        }
Пример #3
0
 public DbPersonAdapter(DbPerson dbPerson)
 {
     _dbPerson = dbPerson;
 }