Lazy Loading after mapping
See original GitHub issueI use Entity Framework and I want to map navigation properties to my DTO’s. So, my question is EF’s navigation properties by default have Lazy loading, its possible with auto mapper after mapping to have the same functionality of lazy loading to my DTO’s.
Here is my DTO’s :
public class CustomerDTO
{
public string CustomerID { get; set; }
public string CompanyName { get; set; }
public ICollection<Order> Orders { get; set; }
}
public class OrderDTO
{
public int OrderID { get; set; }
public string CustomerID { get; set; }
public int? EmployeeID { get; set; }
public string ShipName { get; set; }
public string ShipAddress { get; set; }
public Employee Employee { get; set; }
public Customer Customer { get; set; }
public ICollection<OrderDetail> OrderDetails { get; set; }
}
public class OrderDetailDTO
{
public int OrderID { get; set; }
public decimal UnitPrice { get; set; }
public short Quantity { get; set; }
public Order Order { get; set; }
}
public class EmployeeDTO
{
public int EmployeeID { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public ICollection<Order> Orders { get; set; }
}
Persistent Models:
public class Customer
{
public string CustomerID { get; set; }
public string CompanyName { get; set; }
public ICollection<Order> Orders { get; set; }
}
public class Order
{
public int OrderID { get; set; }
public string CustomerID { get; set; }
public int? EmployeeID { get; set; }
public string ShipName { get; set; }
public string ShipAddress { get; set; }
public Employee Employee { get; set; }
public Customer Customer { get; set; }
public ICollection<OrderDetail> OrderDetails { get; set; }
}
public class OrderDetail
{
public int OrderID { get; set; }
public decimal UnitPrice { get; set; }
public short Quantity { get; set; }
public Order Order { get; set; }
}
public class Employee
{
public int EmployeeID { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public ICollection<Order> Orders { get; set; }
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Lazy load map when they come into the viewport
lazy loading normally means "loading on demand", so, as you say, for example when the map will come into the viewport, whereas your...
Read more >Lazy Loading of Related Data - EF Core
Lazy loading can cause unneeded extra database roundtrips to occur (the so-called N+1 problem), and care should be taken to avoid this. See...
Read more >How to lazy load and initialize elements using an ...
I have a site with a few Leaflet maps here and there and I realized that initializing even a few maps on page...
Read more >Lazy loading React components
The concept of lazy loading is simple: initialize objects that are critical to the user interface first and quietly render noncritical items ...
Read more >Increase the Performance of your Site with Lazy-Loading ...
If the lazy-loaded content hasn't been loaded it won't show up when printing the page. The same can happen when the page is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve changed ORMs several times on various projects, and I promise you, layering and indirection makes it MUCH harder to do so, even impossible.
On Thu, May 18, 2017 at 5:46 AM Efstathios Chrysikos < notifications@github.com> wrote:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.