Beispiel #1
0
        private bool disposed = false; // to detect redundant calls

        public RoleService()
        {
            dataContext  = null;
            userRep      = null;
            unitOfWork   = null;
            appDbContext = null;
            dataContext  = new DataContext(ConfigurationManager.ConnectionStrings["MemomContext"].ConnectionString);
            appDbContext = new MemomContext();
            unitOfWork   = new UnitOfWork(dataContext);
            userRep      = new Repository <UserAccount>(dataContext, unitOfWork);
            _userSvc     = new UserService(userRep, appDbContext, unitOfWork);
        }
Beispiel #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    if (_userSvc != null)
                    {
                        dataContext  = null;
                        userRep      = null;
                        unitOfWork   = null;
                        appDbContext = null;
                        _userSvc     = null;
                    }
                }

                disposed = true;
            }
        }