示例#1
0
        public UnitOfWork(IHttpContextAccessor httpContextAccessor, IServiceProvider servicesProvider)
        {
            _httpContextAccessor = httpContextAccessor;
            _servicesProvider    = servicesProvider;

            if (_httpContextAccessor.HttpContext != null)
            {
                _contextManager = _servicesProvider.GetService <ContextManager>();  /* only with Ninject */
                _context        = _contextManager.Context;
            }
            /// USE SINGLETON (VALIDATE WITH ASYNC)
            else
            {
                int ThreadId = Thread.CurrentThread.ManagedThreadId;
                SynchronizationContext aaaa = SynchronizationContext.Current;

                /// VERIFY IF ALREADY EXISTS AN OPENED CONTEXT FOR THE CURRENT OPERATION
                if (UnitOfWorkContexManager.ContextOpen(ThreadId))
                {
                    _context = (FirstContext)UnitOfWorkContexManager.GetContext(ThreadId);
                    isFirst  = false;
                }
                /// IF NO, THEN CREATE NEW INSTANCE AND OPEN THE TRANSACTION
                else
                {
                    _context = new FirstContext();
                    _context.Database.BeginTransaction();
                    UnitOfWorkContexManager.AddContext(_context, ThreadId);
                }
            }
        }
        public ViewResult ThirdMethod()
        {
            // ViewBag.FirstViewBag = "Evs Lahore";

            FirstContext db = new  FirstContext();


            ViewBag.FirstObject = db.FirstClasses.ToList();

            return(View());
        }
        public ViewResult ThirdMethod(FirstClass obj)
        {
            //ViewBag.FirstObject = obj;

            try
            {
                FirstContext db = new FirstContext();
                db.FirstClasses.Add(obj);
                db.SaveChanges();
                ViewBag.Message = "Successfully Added";
            }
            catch (Exception e)
            {
                ViewBag.Message = $"Something Went Wrong Details {e.Message}";
                return(View());
            }



            return(View());
        }
        /// <summary>
        /// The test first.
        /// </summary>
        private static void TestFirst()
        {
            FirstContext firstContext = new FirstContext();

            // Usually a tree
            ArrayList arrayList = new ArrayList
            {
                new TerminalExpression(),
                new NonTerminalExpression(),
                new TerminalExpression(),
                new TerminalExpression()
            };

            // Populate 'abstract syntax tree'

            // Interpret
            foreach (AbstractExpression abstractExpression in arrayList)
            {
                abstractExpression.Interpret(firstContext);
            }

            // Wait for user
            Console.ReadKey();
        }
示例#5
0
 protected RepositoryAppUser(FirstContext context)
 {
     Db = context;
 }
示例#6
0
 protected Repository(FirstContext context)
 {
     Db = context;
 }
 public CopiaDeDiplomaReportadosModel(FirstContext context)
 {
     _context = context;
 }
 /// <summary>
 /// The interpret.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public abstract void Interpret(FirstContext context);
示例#9
0
 public FirstServices(FirstContext context)
 {
     _context = context;
 }
 public PlanillaContribucionReportadosModel(FirstContext context)
 {
     this._context = context;
 }
示例#11
0
 public HomeController(FirstContext Context)
 {
     _Context = Context;
 }
示例#12
0
 public FormModel(FirstContext context)
 {
     _context = context;
 }
示例#13
0
 public planillaContribucion(FirstContext context)
 {
     _context = context;
 }
 public DiferimientoReportadosModel(FirstContext context)
 {
     _context = context;
 }
示例#15
0
 public AppUserRepository(FirstContext context) : base(context)
 {
 }
 public IndexModel(FirstContext context)
 {
     _context = context;
 }
 /// <summary>
 /// The interpret.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public override void Interpret(FirstContext context)
 {
     Console.WriteLine("Called Terminal.Interpret()");
 }
 public loginPage(FirstContext context)
 {
     _context = context;
 }
示例#19
0
 public CopiaDeDiploma(FirstContext context)
 {
     _context = context;
 }
 public Diferimiento(FirstContext context)
 {
     _context = context;
 }