• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ApplicationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ApplicationContext的典型用法代码示例。如果您正苦于以下问题:C# ApplicationContext类的具体用法?C# ApplicationContext怎么用?C# ApplicationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ApplicationContext类属于命名空间,在下文中一共展示了ApplicationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ApplicationStarted

 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     MemberService.Saved += MemberService_Saved;
     MemberService.Created += MemberService_Created;
     
     MemberService.Deleting += MemberService_Deleting;
 }
开发者ID:Interon,项目名称:uMaster,代码行数:7,代码来源:Events.cs


示例2: WindowsServiceRunner

        /// <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());
            }
        }
开发者ID:andrewmyhre,项目名称:DeployD,代码行数:38,代码来源:WindowsServiceRunner.cs


示例3: OnReceive

        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);
            }
        }
开发者ID:henghu-bai,项目名称:dnx,代码行数:27,代码来源:ConnectionContext.cs


示例4: ConfigurationLoader

        /// <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());

        }
开发者ID:ElderByte-,项目名称:Archimedes.Framework,代码行数:11,代码来源:ConfigurationLoader.cs


示例5: ApplicationStarted

 protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     global::Umbraco.Web.UI.JavaScript.ServerVariablesParser.Parsing += (sender, dictionary) =>
         {
             dictionary["SubscribersList"] = "/umbraco/api/Subscribers/";
         };
 }
开发者ID:AzarinSergey,项目名称:UmbracoE-commerceBadPractic_1,代码行数:7,代码来源:SubscribersController.cs


示例6: Install

        protected override async Task<Result> Install(ApplicationContext context)
        {
            try
            {
                var user = new ApplicationUser();
                user.Email = "[email protected]";
                user.UserName = "[email protected]";

                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);
            }
       }
开发者ID:GasiorowskiPiotr,项目名称:EvilDuck.Cms,代码行数:28,代码来源:SecurityInstaller.cs


示例7: UsersController

 public UsersController(UserManager<ApplicationUser> userManager, ApplicationContext context, ILog log)
 {
     _context = context;
     _userManager = userManager;
     _logger = log;
     _logger.Init(GetType().ToString());
 }
开发者ID:GasiorowskiPiotr,项目名称:EvilDuck.Cms,代码行数:7,代码来源:UsersController.cs


示例8: ApplicationStarted

 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;
 }
开发者ID:AzarinSergey,项目名称:motoCache,代码行数:7,代码来源:RegisterEvents.cs


示例9: PerformAnyRequestedInstallations

        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;
            }
        }
开发者ID:repne,项目名称:DeployD,代码行数:32,代码来源:ServiceInstaller.cs


示例10: SelectUserRolesViewModel

        // 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;
            }
        }
开发者ID:khoaht,项目名称:AngularJSDemo,代码行数:36,代码来源:SelectUserRolesViewModel.cs


示例11: OnReceive

        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);
            }
        }
开发者ID:adwardliu,项目名称:dnx,代码行数:31,代码来源:ConnectionContext.cs


示例12: RolesController

 public RolesController(RoleManager<IdentityRole> roleManager, ApplicationContext context, ILog logging)
 {
     this._rolesManager = roleManager;
     this._context = context;
     this._logging = logging;
     this._logging.Init(typeof(RolesController).FullName);
 }
开发者ID:GasiorowskiPiotr,项目名称:EvilDuck.Cms,代码行数:7,代码来源:RolesController.cs


示例13: GetLocalizedText

 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);
 }
开发者ID:NightOwl888,项目名称:ComplexCommerce,代码行数:7,代码来源:WebPageExecutingBaseExtensions.cs


示例14: PerformAnyRequestedInstallations

        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;
            }
        }
开发者ID:davidwhitney,项目名称:SimpleServices,代码行数:28,代码来源:SimpleServiceApplication.cs


示例15: OnApplicationStarted

 public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
 {
     if (ShouldExecute(applicationContext))
     {
         ApplicationStarted(umbracoApplication, applicationContext);
     }
 }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:7,代码来源:ApplicationEventHandler.cs


示例16: IdentityUnitOfWork

 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);
 }
开发者ID:sweexxik,项目名称:Uav-Site,代码行数:7,代码来源:IdentityUnitOfWork.cs


示例17: Index

 public ActionResult Index()
 {
     var appContext = new ApplicationContext();
     //var gameRep = new GameRepository();
     //var mainPageViewModel = new MainPageViewModel();
     //mainPageViewModel.Games = gameRep.All;
     return View();
 }
开发者ID:nerdumdigitalis,项目名称:leikjavefurinn,代码行数:8,代码来源:HomeController.cs


示例18: ApplicationStarted

        /// <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();
        }
开发者ID:gravypower,项目名称:Gravyframe,代码行数:17,代码来源:GravyframeApplicationEventHandler.cs


示例19: SetupController

 public SetupController(IConfigureOptions<AppSettings> appSettings, ApplicationContext context, IUnitOfWork unitOfWork)
 {
     _settings = new AppSettings();
     appSettings.Configure(_settings);
     
     _appContext = context;
     _unitOfWork = unitOfWork;
 }
开发者ID:GasiorowskiPiotr,项目名称:EvilDuck.Cms,代码行数:8,代码来源:SetupController.cs


示例20: LoginViewModel

 public LoginViewModel(ApplicationContext context)
 {
     CheckUserPasswordCommand = new DelegateCommand(CheckUserPassword, CanCheckUserPassword);
     Context = context;
     #if DEBUG
     this.Identifiant = "test";
     #endif
 }
开发者ID:pr0z,项目名称:Kuhlschrank,代码行数:8,代码来源:LoginViewModel.cs



注:本文中的ApplicationContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ApplicationData类代码示例发布时间:2022-05-24
下一篇:
C# ApplicationConfiguration类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap