Exemplo n.º 1
0
        public EntityChangeNotifier(Expression <Func <TEntity, bool> > query)
        {
            _context          = new TDbContext();
            _query            = query;
            _connectionString = _context.Database.Connection.ConnectionString;

            SafeCountDictionary.Increment(_connectionString, x => { SqlDependency.Start(x); });

            RegisterNotification();
        }
Exemplo n.º 2
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                SafeCountDictionary.Decrement(_connectionString, x => { SqlDependency.Stop(x); });

                if (_context != null)
                {
                    _context.Dispose();
                    _context = null;
                }
            }
        }