/// <summary> /// Constructor /// </summary> /// <param name="settingsService"> </param> /// <param name="loggingService"></param> /// <param name="cacheService"></param> /// <param name="context"></param> public LocalizationService(ISettingsService settingsService, ICacheService cacheService, IKunturContext context) { _settingsService = settingsService; _cacheService = cacheService; _context = context as KunturContext; _perRequestLanguageStrings = ResourceKeysByLanguage(CurrentLanguage); }
/// <summary> /// Constructor /// </summary> public UnitOfWork(KunturContext context) { _context = context; // In order to make calls that are overidden in the caching ef-wrapper, we need to use // transactions from the connection, rather than TransactionScope. // This results in our call e.g. to commit() being intercepted // by the wrapper so the cache can be adjusted. // This won't work with the dbcontext because it handles the connection itself, so we must use the underlying ObjectContext. // http://blogs.msdn.com/b/diego/archive/2012/01/26/exception-from-dbcontext-api-entityconnection-can-only-be-constructed-with-a-closed-dbconnection.aspx _objectContext = ((IObjectContextAdapter)_context).ObjectContext; // Updating EF timeout taken from // http://stackoverflow.com/questions/6232633/entity-framework-timeouts //_objectContext.CommandTimeout = 3 * 60; // value in seconds if (_objectContext.Connection.State != ConnectionState.Open) { _objectContext.Connection.Open(); _transaction = _objectContext.Connection.BeginTransaction(); } }
public UnitOfWorkManager(IKunturContext context) { //http://www.entityframeworktutorial.net/code-first/automated-migration-in-code-first.aspx Database.SetInitializer(new MigrateDatabaseToLatestVersion<KunturContext, Configuration>(SiteConstants.Instance.MvcKunturContext)); _context = context as KunturContext; }
public EmailService(ILoggingService loggingService, ISettingsService settingsService, IKunturContext context) { _loggingService = loggingService; _settingsService = settingsService; _context = context as KunturContext; }
/// <summary> /// Constructor /// </summary> /// <param name="context"> </param> /// <param name="cacheService"></param> public SettingsService(IKunturContext context, ICacheService cacheService) { _cacheService = cacheService; _context = context as KunturContext; }