Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Custom wrapper class.
- namespace Data
- {
- public class Customer
- {
- public int Id {get;set;}
- public string Name {get;set;}
- public IList<Address> Addresses {get;set;}
- }
- }
- //Linq-Generated Class - severly abbreviated
- namespace SqlRepository
- {
- public class Customer
- {
- public int Id {get;set;}
- public string Name {get;set;}
- public EntitySet<Address> {get;set;}
- }
- }
- //Customer Repository
- namespace SqlRepository
- {
- public class UserRepository : IUserRepository
- {
- private _db = new DB(); //This is the Linq-To-Sql datacontext
- public IQueryable GetCusomters()
- {
- return
- from c in _db.Customers
- select new Customer // This is the wrapper class not the gen'd one
- {
- Id = c.Id,
- Name = c.Name,
- Addresses = new LazyList(c.Addresses)
- };
- }
Add Comment
Please, Sign In to add comment