Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public sealed class SearchPeopleResultsViewModel : ViewModelBase
- {
- private LinqAsyncDataSourceProvider _provider;
- private PeopleContext _context;
- public SearchPeopleResultsViewModel()
- {
- _context = new PeopleContext();
- _context.Configuration.ProxyCreationEnabled = false;
- _context.Configuration.AutoDetectChangesEnabled = false;
- _context.Configuration.LazyLoadingEnabled = false;
- IQueryable<Person> people = _context.People.AsNoTracking();
- _provider = new LinqAsyncDataSourceProvider(people);
- }
- public DataSourceProvider SearchResults
- {
- get { return _provider; }
- }
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing)
- {
- if (null != _provider)
- {
- _provider.Dispose();
- _provider = null;
- }
- if (null != _context)
- {
- _context.Dispose();
- _context = null;
- }
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement