Example #1
0
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     MemberService.Saved += MemberService_Saved;
     MemberService.Created += MemberService_Created;
     
     MemberService.Deleting += MemberService_Deleting;
 }
        /// <summary>
        /// Executes the provided IWindowsServices and supports automatic installation using the command line params -install / -uninstall
        /// </summary>
        /// <param name="args"></param>
        /// <param name="createServices">Function which provides a WindowsServiceCollection of services to execute</param>
        /// <param name="configureContext">Optional application context configuration</param>
        /// <param name="installationSettings">Optional installer configuration with semi-sensible defaults</param>
        /// <param name="registerContainer">Optionally register an IoC container</param>
        /// <param name="agentSettingsManager">Optionally provide agent settings </param>
        public WindowsServiceRunner(string[] args,
            Func<IWindowsService[]> createServices,
            Action<ApplicationContext> configureContext = null,
            Action<System.ServiceProcess.ServiceInstaller,
            ServiceProcessInstaller> installationSettings = null,
            Func<IIocContainer> registerContainer = null,
            IAgentSettingsManager agentSettingsManager = null,
            Action<ApplicationContext,string> notify=null)
        {
            _notify = notify ?? ((ctx,message) => { });
            var log = LogManager.GetLogger(typeof (WindowsServiceRunner));
            _args = args;
            _context = new ApplicationContext();
            _createServices = createServices;
            _agentSettingsManager = agentSettingsManager;
            _logger = log;
            _configureContext = configureContext ?? (ctx => {  });
            _context.ConfigureInstall = installationSettings ?? ((serviceInstaller, serviceProcessInstaller) => { });
            _context.Container = registerContainer;

            if (registerContainer==null)
            {
                throw new ArgumentException("Binding container is null");
            }
            if (registerContainer != null)
            {
                _logger.DebugFormat("container is " + registerContainer.ToString());
            }
        }
Example #3
0
 public IdentityUnitOfWork(string connectionString)
 {
     _db = new ApplicationContext(connectionString);
     _userManager = new ApplicationUserManager(new UserStore<ApplicationUser>(_db));
     _roleManager = new ApplicationRoleManager(new RoleStore<ApplicationRole>(_db));
     _clientManager = new ClientManager(_db);
 }
        public static void PerformAnyRequestedInstallations(string[] args, ApplicationContext context, string assemblyLocation = null)
        {
            if(assemblyLocation == null)
            {
                assemblyLocation = Assembly.GetEntryAssembly().Location;
            }

            var behavior = GetInstallBehavior(args);

            var parameter = string.Concat(args);
            _configureAction = x => x.ConfigureServiceInstall(context);

            switch (behavior)
            {
                case InstallBehavior.Install:
                    EnsureElevated(args);
                    InstallAssemblyAsService(assemblyLocation);
                    break;
                case InstallBehavior.Uninstall:
                    EnsureElevated(args);
                    UninstallService(assemblyLocation);
                    break;
                case InstallBehavior.TryInstall:
                    EnsureElevated(args);
                    TryInstallAsService(assemblyLocation);
                    break;
            }
        }
Example #5
0
        public void OnReceive(Message message)
        {
            // Mark the sender on the incoming message
            message.Sender = this;

            if (_protocolManager.IsProtocolNegotiation(message))
            {
                _protocolManager.Negotiate(message);
            }
            else
            {
                ApplicationContext applicationContext;
                if (!_contexts.TryGetValue(message.ContextId, out applicationContext))
                {
                    Logger.TraceInformation("[ConnectionContext]: Creating new application context for {0}", message.ContextId);

                    applicationContext = new ApplicationContext(_services,
                                                                _protocolManager,
                                                                new CompilationEngineFactory(_cache),
                                                                message.ContextId);

                    _contexts.Add(message.ContextId, applicationContext);
                }

                applicationContext.OnReceive(message);
            }
        }
Example #6
0
        public static void PerformAnyRequestedInstallations(string[] args, ApplicationContext context, string assemblyLocation = null)
        {
            if(assemblyLocation == null)
            {
                assemblyLocation = Assembly.GetEntryAssembly().Location;
            }

            var parameter = string.Concat(args);
            _configureAction = x => x.ConfigureServiceInstall(context);

            switch (parameter)
            {
                case "-install":
                case "/install":
                case "-i":
                case "/i":
                    InstallAssemblyAsService(assemblyLocation);
                    break;
                case "-uninstall":
                case "/uninstall":
                case "-u":
                case "/u":
                    UninstallService(assemblyLocation);
                    break;
                case "-tryinstall":
                case "/tryinstall":
                case "-ti":
                case "/ti":
                    TryInstallAsService(assemblyLocation);
                    break;
            }
        }
 private static string GetLocalizedText(string virtualPath, string textName)
 {
     var appContext = new ApplicationContext();
     var list = ViewTextLocaleList.GetCachedViewTextLocaleList(
         appContext.CurrentTenant.Id, appContext.CurrentLocaleId, virtualPath);
     return list.GetLocalizedText(textName);
 }
        protected override async Task<Result> Install(ApplicationContext context)
        {
            try
            {
                var user = new ApplicationUser();
                user.Email = "admin@evilduck";
                user.UserName = "******";

                var userManager = (UserManager<ApplicationUser>)ApplicationServices.GetService(typeof(UserManager<ApplicationUser>));
                var result = await userManager.CreateAsync(user, "!QAZxsw2#");

                if(!result.Succeeded)
                {
                    return Result.Failure(String.Join(",", result.Errors.Select(e => e.Description)));
                }

                result = await userManager.AddToRoleAsync(user, "Administrator");
                if(!result.Succeeded)
                {
                    return Result.Failure(String.Join(",", result.Errors.Select(e => e.Description)));
                }
                return Result.Success();
            }
            catch(Exception ex)
            {
                return Result.Failure("Błąd w czasie dodawanie administratora", Request, ex);
            }
       }
 public RolesController(RoleManager<IdentityRole> roleManager, ApplicationContext context, ILog logging)
 {
     this._rolesManager = roleManager;
     this._context = context;
     this._logging = logging;
     this._logging.Init(typeof(RolesController).FullName);
 }
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     global::Umbraco.Web.UI.JavaScript.ServerVariablesParser.Parsing += (sender, dictionary) =>
         {
             dictionary["SubscribersList"] = "/umbraco/api/Subscribers/";
         };
 }
 public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     if (ShouldExecute(applicationContext))
     {
         ApplicationStarted(umbracoApplication, applicationContext);
     }
 }
Example #12
0
 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     try { ((LuceneIndexer)ExamineManager.Instance.IndexProviderCollection["MotoIndexer"]).IfNotNull(x => x.DocumentWriting += MotosIndexerExternalFields); } catch (Exception) { }
     ContentService.Saving += DocumentAfterSaving;
     ContentService.Published += CacheAfterPublishNode;
     ContentService.UnPublished += CacheAfterUnPublishNode;
 }
 public UsersController(UserManager<ApplicationUser> userManager, ApplicationContext context, ILog log)
 {
     _context = context;
     _userManager = userManager;
     _logger = log;
     _logger.Init(GetType().ToString());
 }
Example #14
0
        public void OnReceive(Message message)
        {
            // Mark the sender on the incoming message
            message.Sender = this;

            if (_protocolManager.IsProtocolNegotiation(message))
            {
                _protocolManager.Negotiate(message);
            }
            else
            {
                ApplicationContext applicationContext;
                if (!_contexts.TryGetValue(message.ContextId, out applicationContext))
                {
                    Logger.TraceInformation("[ConnectionContext]: Creating new application context for {0}", message.ContextId);

                    applicationContext = new ApplicationContext(_services,
                                                                _applicationEnvironment,
                                                                _runtimeEnvironment,
                                                                _loadContextAccessor,
                                                                _protocolManager,
                                                                _compilationEngine,
                                                                _frameworkResolver,
                                                                message.ContextId);

                    _contexts.Add(message.ContextId, applicationContext);
                }

                applicationContext.OnReceive(message);
            }
        }
        /// <summary>
        /// Creates a new configuration loader for the given application context.
        /// </summary>
        /// <param name="ctx">The application context</param>
        public ConfigurationLoader(ApplicationContext ctx)
        {
            _ctx = ctx;
            ConfigurationProcessors.Add(new ComponentScanProvider());
            ConfigurationProcessors.Add(new ComponentBindingProvider());

        }
        // Enable initialization with an instance of ApplicationUser:
        public SelectUserRolesViewModel(ApplicationUser user)
            : this()
        {
            var db = new ApplicationContext();

            // Add all available roles to the list of EditorViewModels:
            var findUser = db.Users.First(u=>u.Email == user.Email);
            if (findUser != null)
            {
                Id = findUser.Id;
                Email = findUser.Email;
                FirstName = findUser.FirstName;
                UserName = findUser.UserName;
                LastName = findUser.LastName;
                Address = findUser.Address;
                City = findUser.City;
                Province = findUser.Province;
            }
            var allRoles = db.Roles;
            foreach (var role in allRoles)
            {
                // An EditorViewModel will be used by Editor Template:
                var rvm = new SelectRoleEditorViewModel(role);
                Roles.Add(rvm);
            }

            // Set the Selected property to true for those roles for
            // which the current user is a member:
            foreach (var userRole in user.Roles)
            {
                var checkUserRole =
                    Roles.Find(r => r.RoleName == userRole.Role.Name);
                checkUserRole.Selected = true;
            }
        }
 public async Task PerformInstallation(ApplicationContext context)
 {
     if(await CanPerform(context))
     {
         var result = await Install(context);
         result.ThrowIfError();
     }
 }
Example #18
0
 public LoginViewModel(ApplicationContext context)
 {
     CheckUserPasswordCommand = new DelegateCommand(CheckUserPassword, CanCheckUserPassword);
     Context = context;
     #if DEBUG
     this.Identifiant = "test";
     #endif
 }
        /// <summary>
        /// The application started.
        /// </summary>
        /// <param name="umbracoApplication">
        /// The umbraco application.
        /// </param>
        /// <param name="applicationContext">
        /// The application context.
        /// </param>
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            var automaticServiceHosting = new AutomaticServiceHosting<IAutomaticServiceHostingConfigurationStrategy>();
            automaticServiceHosting.Initialise();

            var gravyframeHost = new GravyframeHost(automaticServiceHosting.ConfigurationStrategies, "Gravyframe Services", automaticServiceHosting.ServiceAssembly);
            gravyframeHost.Init();
        }
 public ActionResult Index()
 {
     var appContext = new ApplicationContext();
     //var gameRep = new GameRepository();
     //var mainPageViewModel = new MainPageViewModel();
     //mainPageViewModel.Games = gameRep.All;
     return View();
 }
 public SetupController(IConfigureOptions<AppSettings> appSettings, ApplicationContext context, IUnitOfWork unitOfWork)
 {
     _settings = new AppSettings();
     appSettings.Configure(_settings);
     
     _appContext = context;
     _unitOfWork = unitOfWork;
 }
Example #22
0
 public Models.Profile GetProfileById(int profileId)
 {
     using (var context = new ApplicationContext())
     {
         var model = context.Profiles.Find(profileId);
         return model;
     }
 }
Example #23
0
		public TestBase()
		{
			// Setup the application context
			this.AppContext = new ApplicationContext {
				Cache = new MemoryCacheClient(),
				Factory = new FactoryProvider(null),
				Resources = new ConfigurationResourceManager(),
			};
		}
 public void HandleConfiguration(ApplicationContext ctx, Type configurationType)
 {
     var componentBindings = configurationType.GetCustomAttributes(typeof(ComponentBindingAttribute), false);
     foreach (ComponentBindingAttribute componentBinding in componentBindings)
     {
         ctx.Container.Configuration.RegisterSingleton(componentBinding.Iface, componentBinding.Implementation);
         Log.Info(string.Format("Configured component binding '{0}' --> '{1}'", componentBinding.Iface, componentBinding.Implementation));
     }
 }
        protected override async Task<Result> Install(ApplicationContext context)
        { 
            var role = new IdentityRole();
            role.Name = "Administrator";

            context.Roles.Add(role);

            return await Task.FromResult(Result.Success());
        }
 public ViewResult Outcoming()
 {
     List<Document> list = new List<Document>();
     using (ApplicationContext context = new ApplicationContext())
     {
         list = db.documents.Where(x => AccountController.UserId == x.currentid).ToList();
     }
     return View(list);
 }
Example #27
0
 public static async Task RunBoardAsync()
 {
     using (var client = new HttpClient())
     {
         //Send Http Request
         client.BaseAddress = new Uri("http://localhost:12314/");        
         client.DefaultRequestHeaders.Accept.Clear();
         client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
 
         //try
         //{
         // HTTP GET (Getting resource(s))
         Console.WriteLine("Now consuming...");
         HttpResponseMessage response = await client.GetAsync("api/Boards?q={}");
         response.EnsureSuccessStatusCode();
         if (response.IsSuccessStatusCode)
         {
             using (var db = new ApplicationContext())
             {
                 Console.WriteLine("Success, Now reading...");
                 var board = response.Content.ReadAsAsync<dynamic>().Result;
                 Console.WriteLine("Id\tOwnerId\tTitle\tOrder\tCreatedAt\tLastUPdateTime");
                 foreach (var x in board.Data)
                 {
                     Board b = new Board();
                     int _emptyID = Convert.ToInt32(x.Id);
                     var v = db.Boards.Where(c => c.Id.Equals(_emptyID)).FirstOrDefault();
                     if (v != null)
                     {
                         v.Id = x.Id;
                         v.OwnerId = x.OwnerId;
                         v.Title = x.Title;
                         v.Order = x.Order;
                         v.CreatedAt = x.CreatedAt;
                         v.LastUpdateTime = x.LastUpdateTime;
                         Console.WriteLine("Updating data number " + v.Id + "");
                         db.Entry(v).State = EntityState.Modified;
                     }
                     else
                     {
                         b.Id = x.Id;
                         b.OwnerId = x.OwnerId;
                         b.Title = x.Title;
                         b.Order = x.Order;
                         b.CreatedAt = x.CreatedAt;
                         b.LastUpdateTime = x.LastUpdateTime;
                         db.Boards.Add(b);
                         Console.WriteLine("Adding data number " + b.Id + "");
                     }
                     db.SaveChanges();
                 }
             }
         }
         else { Console.WriteLine("Unsuccessful"); }
     }
 }
Example #28
0
 public void ApplicationViewModelConstructorTest()
 {
     mocks.ReplayAll();
     ApplicationContext target = new ApplicationContext(ioService, new DesignSettingsProvider(),
         new DesignMainWindow(), new DesignTaskContext(new DesignTaskService()), new DesignViewProvider());
     mocks.VerifyAll();
     Assert.Throws<ApplicationException>(() => target =
         new ApplicationContext(ioService, new DesignSettingsProvider(), new DesignMainWindow(),
             new DesignTaskContext(new DesignTaskService()), new DesignViewProvider()));
 }
Example #29
0
        public void Configuration(IAppBuilder app)
        {
            log4net.Config.XmlConfigurator.Configure();

            var appContext = new ApplicationContext("PushNotifications");
            var cfgRepo = new ConsulForPandora(new Uri("http://consul.local.com:8500"));
            var pandora = new Pandora(appContext, cfgRepo);

            app.UseHttpWebApi(pandora);
        }
        public ApplicationViewModel(Repository repository, ApplicationContext applicationContext, WindowManager windowManager)
        {
            if (repository == null) throw new ArgumentNullException("repository");
            if (applicationContext == null) throw new ArgumentNullException("applicationContext");
            if (windowManager == null) throw new ArgumentNullException("windowManager");

            Repository = repository;
            WindowManager = windowManager;
            ApplicationContext = applicationContext;
        }
Example #31
0
        private static async Task SeedUsers(ApplicationContext context, IServiceProvider serviceProvider)
        {
            var categories = await context.Categories.ToListAsync();

            PasswordHasher <User> hasher = new PasswordHasher <User>(
                new OptionsWrapper <PasswordHasherOptions>(
                    new PasswordHasherOptions()
            {
                CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2
            })
                );

            var users = UserData.FakeUser.Generate(NumberOfUsers);

            users.ForEach(u =>
            {
                u.RecommendationScores =
                    categories.Select(x => new RecommendationScore {
                    Category = x, Weight = 0
                }).ToList();
                u.Password = hasher.HashPassword(u, "Password");
            });

            var testUser = new User
            {
                Id        = new Guid("23C6C78B-5754-48A5-82E3-5772AA462CDE"),
                Email     = "*****@*****.**",
                FirstName = "Test",
                LastName  = "User",
                UserName  = "******",
                Avatar    = Encoding.UTF8.GetBytes("https://picsum.photos/640/480/?image=41"),
                Address   = new Address
                {
                    City         = "Stowmarket",
                    AddressLine1 = "21 Wellsway",
                    PostalCode   = "IP146SL",
                    CountryCode  = "GB",
                    CountryName  = "United Kingdom"
                },
                PhoneNumber      = "+4407852276048",
                IsDarkMode       = false,
                Confirmed        = true,
                DateOfBirth      = new DateTime(2000, 7, 24),
                StripeAccountId  = "acct_1IeMUv2euIlqIANk",
                StripeCustomerId = "cus_JGuDCovqvDgFjb",
                PaymentMethods   = new List <PaymentMethod>()
                {
                    new()
                    {
                        StripeCardId = "card_1IeMQzK2ugLXrgQX48FGjxMT",
                        LastFour     = "0005",
                        Brand        = "Visa",
                        Funding      = "debit",
                        ExpiryMonth  = 11,
                        ExpiryYear   = 2024,
                        Country      = "GB",
                        NickName     = "Debit",
                        Name         = "TestUser",
                        IsDefault    = true
                    }
                },
 public BaseProvider(ApplicationContext db) : base(db)
 {
     dbSet = this.db.Set <T>();
 }
Example #33
0
        public void OnApplicationStarted(
            UmbracoApplicationBase httpApplication,
            ApplicationContext applicationContext
            )
        {
            var container     = UnityConfig.Container;
            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);

            // MVC Configuration
            DependencyResolver.SetResolver(new UnityDependencyResolver(container));

            // Web API Configuration
            GlobalConfiguration.Configuration.DependencyResolver =
                new Unity.AspNet.WebApi.UnityDependencyResolver(container);

            container.RegisterTypes(
                AllClasses.FromAssemblies(typeof(UnityEvents).Assembly),
                WithMappings.FromMatchingInterface,
                WithName.Default
                );

            // -- UmbracoContext resolution for backoffice controllers --
            container.RegisterFactory <UmbracoContext>(
                (containr, type, name) => UmbracoContext.Current,
                new PerRequestLifetimeManager());
            container.RegisterFactory <IContentService>(
                (containr, type, name) => applicationContext.Services.ContentService,
                new PerRequestLifetimeManager());
            container.RegisterFactory <IMediaService>(
                (containr, type, name) => applicationContext.Services.MediaService,
                new PerRequestLifetimeManager());
            container.RegisterInstance <ITypedPublishedContentQuery>(
                umbracoHelper.ContentQuery,
                new ContainerControlledLifetimeManager());

            // -- Umbraco controller injection --
            container.RegisterType <RenderMvcController>(
                new InjectionConstructor(new ResolvedParameter <UmbracoContext>())
                );
            container.RegisterType <LegacyTreeController>(
                new InjectionConstructor());
            container.RegisterType <MVC.UmbracoAuthorizeAttribute>(
                new InjectionConstructor());
            container.RegisterType <WebAPI.UmbracoAuthorizeAttribute>(
                new InjectionConstructor());
            container.RegisterType <UserTreeController>(
                new InjectionConstructor());
            container.RegisterType <UsersController>(
                new InjectionConstructor());
            container.RegisterType <HealthCheckController>(
                new InjectionConstructor());

            // -- Application specific type registration --
            // Business Logic
            container.RegisterType <IConfigurationService, ConfigurationService>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IInstantWinService, InstantWinService>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IParticipationService, ParticipationService>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <ISynchronizationService, SynchronizationService>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IValidationService, ValidationService>(
                new ContainerControlledLifetimeManager());

            // Data Access Layer
            //// Umbraco
            container.RegisterType <IPublishedContentManager, PublishedContentManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IContentServiceManager, ContentServiceManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IMediaServiceManager, MediaServiceManager>(
                new ContainerControlledLifetimeManager());
            //// Repositories
            container.RegisterType(typeof(IGenericManager <>), typeof(GenericManager <>));
            container.RegisterType <IConsumerManager, ConsumerManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <ICountryManager, CountryManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IFailedTransactionManager, FailedTransactionManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IInstantWinMomentManager, InstantWinMomentManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IParticipationManager, ParticipationManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IParticipantManager, ParticipantManager>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IPrizeManager, PrizeManager>(
                new ContainerControlledLifetimeManager());

            // Infrastructure
            container.RegisterType <ICrmConsumerProvider, ConsumerProvider>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IFormValidatorProvider, CaptchaProvider>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <ILogoValidatorProvider, LogoGrabProvider>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <ISchedulerProvider, HangfireProvider>(
                new ContainerControlledLifetimeManager());
            container.RegisterType <IInstantWinMomentProvider, InstantWinProvider>(
                new ContainerControlledLifetimeManager());
        }
 public CustomersController()
 {
     _context = new ApplicationContext();
 }
 public UpdateInstructorCommandHandler(ApplicationContext context)
 {
     _context = context;
 }
Example #36
0
 public BaseRepository(ApplicationContext context)
 {
     _context = context;
 }
Example #37
0
 public static async Task SeedDatabase(ApplicationContext context, IServiceProvider serviceProvider)
 {
     await SeedUsers(context, serviceProvider);
     await SeedEvents(context, serviceProvider);
     await SeedInteraction(context);
 }
 public GetCommentsByNewsIdHandler(ApplicationContext context)
 {
     _context = context;
 }
Example #39
0
 public WishListRepository(ApplicationContext ApplicationContext) : base(ApplicationContext)
 {
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="applicationContext">The current ApplicationContext</param>
 public ApplicationContextProvider(ApplicationContext applicationContext)
 {
     _applicationContext = applicationContext;
 }
 public SelectionСommitteeController(ApplicationContext context)
 {
     _context = context;
 }
Example #42
0
 void HandleTitleChanged(object sender, WebFrameTitleEventArgs e)
 {
     ApplicationContext.InvokeUserCode(EventSink.OnTitleChanged);
 }
Example #43
0
 void HandleActivated(object sender, EventArgs e)
 {
     ApplicationContext.InvokeUserCode(EventSink.ValueChanged);
 }
 public ProductSubCategoryRepository(ApplicationContext context) : base(context)
 {
 }
Example #45
0
 public void OnApplicationInitialized(
     UmbracoApplicationBase httpApplication,
     ApplicationContext applicationContext)
 {
 }
Example #46
0
        public async Task <IActionResult> Questions([FromServices] ApplicationContext db)
        {
            var que = await db.Questions.ToListAsync();

            return(View(que));
        }
Example #47
0
 public CategoryRepository(ApplicationContext context) : base(context)
 {
 }
Example #48
0
        /// <summary>
        /// OVerridable method to execute when All resolvers have been initialized but resolution is not frozen so they can be modified in this method
        /// </summary>
        /// <param name="umbracoApplication"/><param name="applicationContext"/>
        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            base.ApplicationStarting(umbracoApplication, applicationContext);

            UrlProviderResolver.Current.AddType <VirtualNodeUrlProvider>();

            UrlProviderResolver.Current.InsertTypeBefore <DefaultUrlProvider, DateFormattedUrlProvider>();
            ContentFinderResolver.Current.InsertTypeBefore <ContentFinderByNiceUrl, DateFormattedPostContentFinder>();
        }
Example #49
0
 public TagController(ApplicationContext db)
 {
     _db = db;
 }
Example #50
0
 public LemmatizationService(ApplicationContext context, IAFINNService afinn)
 {
     _context = context;
     _afinn = afinn;
 }
Example #51
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            //list to the init event of the application base, this allows us to bind to the actual HttpApplication events
            UmbracoApplicationBase.ApplicationInit += UmbracoApplicationBase_ApplicationInit;

            //map routes
            RouteTable.Routes.MapRoute(
                "ArticulateFeeds",
                "ArticulateFeeds/{action}/{id}",
                new { controller = "Feed", action = "RenderGitHubFeed", id = 0 }
                );
            ArticulateRoutes.MapRoutes(RouteTable.Routes, UmbracoContext.Current.ContentCache, UmbracoContext.Current.UrlProvider);

            //umbraco event subscriptions
            ContentService.Created               += ContentService_Created;
            ContentService.Saving                += ContentService_Saving;
            ContentService.Saved                 += ContentService_Saved;
            ServerVariablesParser.Parsing        += ServerVariablesParser_Parsing;
            ContentTypeService.SavingContentType += ContentTypeService_SavingContentType;
            PageCacheRefresher.CacheUpdated      += PageCacheRefresher_CacheUpdated;
            DomainCacheRefresher.CacheUpdated    += DomainCacheRefresher_CacheUpdated;
        }
Example #52
0
 void OnClicked(DialogButton button)
 {
     ApplicationContext.InvokeUserCode(delegate {
         ((IDialogEventSink)EventSink).OnDialogButtonClicked(button);
     });
 }
Example #53
0
 public RedditService(ApplicationContext applicationContext)
 {
     this.applicationContext = applicationContext;
 }
Example #54
0
 public void OnApplicationStarting(
     UmbracoApplicationBase httpApplication,
     ApplicationContext applicationContext)
 {
 }
Example #55
0
 void HandleLoadStarted(object o, EventArgs args)
 {
     ApplicationContext.InvokeUserCode(EventSink.OnLoading);
 }
Example #56
0
        _userManager;                                                                      // Добавил менеджер пользователей для поиска текущего пользователя

        public NotesController(ApplicationContext context, UserManager <User> userManager) // Тжс
        {
            _context     = context;
            _userManager = userManager;
        }
 public RepositoryDIA(ApplicationContext dbContext)
     : base(dbContext)
 {
 }
Example #58
0
 void HandleLoadFinished(object o, EventArgs args)
 {
     SetCustomCss();
     ApplicationContext.InvokeUserCode(EventSink.OnLoaded);
 }
Example #59
0
 public CadastroRepository(ApplicationContext contexto) : base(contexto)
 {
 }
Example #60
0
 public AnswersService(IMapper mapper, ApplicationContext context, UserService userService) : base(mapper, context)
 {
     _userService = userService;
 }