public static ContosoUniversity.DAL.SalesModel.Book ToEntity(this BookDto source) { if (source == null) { return(null); } var target = new ContosoUniversity.DAL.SalesModel.Book(); // Properties target.Price = source.Price; target.RowVersion = source.RowVersion; target.Category = source.Category; target.EnDescription = source.EnDescription; target.ArDescription = source.ArDescription; target.Id = source.Id; target.ISBN = source.ISBN; target.PublisherId = source.PublisherId; target.Langauge = source.Langauge; // User-defined partial method OnEntityCreating(source, target); return(target); }
public static BookDto ToDtoWithRelated(this ContosoUniversity.DAL.SalesModel.Book source, int level) { if (source == null) { return(null); } var target = new BookDto(); // Properties target.Price = source.Price; target.RowVersion = source.RowVersion; target.Category = source.Category; target.EnDescription = source.EnDescription; target.ArDescription = source.ArDescription; target.Id = source.Id; target.ISBN = source.ISBN; target.PublisherId = source.PublisherId; target.Langauge = source.Langauge; // Navigation Properties if (level > 0) { target.Publisher = source.Publisher.ToDtoWithRelated(level - 1); target.Authors = source.Authors.ToDtosWithRelated(level - 1); } // User-defined partial method OnDtoCreating(source, target); return(target); }
static partial void OnEntityCreating(BookDto source, ContosoUniversity.DAL.SalesModel.Book target);
public static BookDto ToDto(this ContosoUniversity.DAL.SalesModel.Book source) { return(source.ToDtoWithRelated(0)); }
static partial void OnDtoCreating(ContosoUniversity.DAL.SalesModel.Book source, BookDto target);