Esempio n. 1
0
 protected static void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (UnitTestDetector.IsInUnitTest)
         {
             instanceCreatedForTDDOrConsoleApp = null;
         }
         else if (HttpContext.Current != null && (HttpContext.Current.Items[REPOSITORY_FACADE_KEY] != null))
         {
             HttpContext.Current.Items[REPOSITORY_FACADE_KEY] = null;
         }
     }
 }
Esempio n. 2
0
        public static TAppRepositoryFacade GetInstance <TAppRepositoryFacade>() where TAppRepositoryFacade : RepositoryFacadeBase <TContext>, new()
        {
            if (UnitTestDetector.IsInUnitTest)
            {
                if (instanceCreatedForTDDOrConsoleApp == null)
                {
                    instanceCreatedForTDDOrConsoleApp = new TAppRepositoryFacade();
                }

                return((TAppRepositoryFacade)instanceCreatedForTDDOrConsoleApp);
            }
            else if (HttpContext.Current != null)
            {
                if (HttpContext.Current.Items[REPOSITORY_FACADE_KEY] == null)
                {
                    HttpContext.Current.Items[REPOSITORY_FACADE_KEY] = new TAppRepositoryFacade();
                }
                return((TAppRepositoryFacade)HttpContext.Current.Items[REPOSITORY_FACADE_KEY]);
            }
            else
            {
                return(null);
            }
        }