Example #1
0
        public TDbContext Get <TDbContext>() where TDbContext : DbContext
        {
            TDbContext context;

            if (_uowManager.Current == null)
            {
                context = _ioCManager.GetService <TDbContext>();
                return(context);
            }

            context = _uowManager.Current.GetDbContext <TDbContext>();
            if (context != null)
            {
                return(context);
            }
            context = _ioCManager.GetService <TDbContext>();
            _uowManager.Current.AddDbContext(context);
            return(context);
        }
Example #2
0
        public TDbContext Get <TDbContext>() where TDbContext : DbContext
        {
            var context = _ioCManager.GetService <TDbContext>();

            return(context);
        }