示例#1
0
        public static DtoGen.Sample_02.Model.User TransformToSource(this DtoGen.Sample_02.DTO.UserData target)
        {
            DtoGen.Core.PropertyConverter.EnsureInitialized();
            DtoGen.Sample_02.Model.User source = new DtoGen.Sample_02.Model.User();
            source.Id        = target.Id;
            source.Name      = target.Name;
            source.Email     = target.Email;
            source.Street    = target.Street;
            source.City      = target.City;
            source.ZIP       = target.ZIP;
            source.State     = target.State;
            source.Country   = target.Country;
            source.TaxNumber = target.TaxNumber;
            ReplaceEntriesCollectionHandler <GenreData, Genre> ___favoriteGenresCollectionHandler = new ReplaceEntriesCollectionHandler <GenreData, Genre>();

            if (source.FavoriteGenres == null)
            {
                source.FavoriteGenres = new List <Genre>();
            }
            if (target.FavoriteGenres == null)
            {
                target.FavoriteGenres = new List <GenreData>();
            }
            ___favoriteGenresCollectionHandler.SynchronizeCollections(target.FavoriteGenres, source.FavoriteGenres);
            SyncCollectionHandler <BookData, Book> ___booksCollectionHandler = new SyncCollectionHandler <BookData, Book>();

            ___booksCollectionHandler.KeySelector1     = __x => __x.Id;
            ___booksCollectionHandler.KeySelector2     = __x => __x.Id;
            ___booksCollectionHandler.NewItemFactory   = DtoGen.Core.PropertyConverter.Convert <BookData, Book>;
            ___booksCollectionHandler.UpdateItemAction = DtoGen.Core.PropertyConverter.Populate <BookData, Book>;
            if (source.Books == null)
            {
                source.Books = new List <Book>();
            }
            if (target.Books == null)
            {
                target.Books = new List <BookData>();
            }
            ___booksCollectionHandler.SynchronizeCollections(target.Books, source.Books);
            return(source);
        }
示例#2
0
        public static void PopulateTarget(this DtoGen.Sample_02.Model.User source, DtoGen.Sample_02.DTO.UserData target)
        {
            DtoGen.Core.PropertyConverter.EnsureInitialized();
            target.Id        = source.Id;
            target.Name      = source.Name;
            target.Email     = source.Email;
            target.Street    = source.Street;
            target.City      = source.City;
            target.ZIP       = source.ZIP;
            target.State     = source.State;
            target.Country   = source.Country;
            target.TaxNumber = source.TaxNumber;
            ReplaceEntriesCollectionHandler <Genre, GenreData> ___favoriteGenresCollectionHandler = new ReplaceEntriesCollectionHandler <Genre, GenreData>();

            if (source.FavoriteGenres == null)
            {
                source.FavoriteGenres = new List <Genre>();
            }
            if (target.FavoriteGenres == null)
            {
                target.FavoriteGenres = new List <GenreData>();
            }
            ___favoriteGenresCollectionHandler.SynchronizeCollections(source.FavoriteGenres, target.FavoriteGenres);
            SyncCollectionHandler <Book, BookData> ___booksCollectionHandler = new SyncCollectionHandler <Book, BookData>();

            ___booksCollectionHandler.KeySelector1     = __x => __x.Id;
            ___booksCollectionHandler.KeySelector2     = __x => __x.Id;
            ___booksCollectionHandler.NewItemFactory   = DtoGen.Core.PropertyConverter.Convert <Book, BookData>;
            ___booksCollectionHandler.UpdateItemAction = DtoGen.Core.PropertyConverter.Populate <Book, BookData>;
            if (source.Books == null)
            {
                source.Books = new List <Book>();
            }
            if (target.Books == null)
            {
                target.Books = new List <BookData>();
            }
            ___booksCollectionHandler.SynchronizeCollections(source.Books, target.Books);
        }