/// <summary> /// Create an IronPython enabled service container with explicit spark settings. /// </summary> /// <param name="settings">Typically an instance of SparkSettings object</param> /// <returns>A configured service container. Additional service builders may /// me added. May be passed to RegisterViewEngine.</returns> public static ISparkServiceContainer CreateContainer(ISparkSettings settings) { var container = new SparkServiceContainer(settings); ConfigureContainer(container); return(container); }
public SparkResourceContentFetcher(ISparkSettings settings) { _settings = settings; _sparkViewEngine = new SparkViewEngine(_settings); _sparkViewEngine.ViewFolder = new FileSystemViewFolder(Path.Combine(AssmanConfiguration.Current.RootFilePath, "Views")); _descriptorBuilder = new DefaultDescriptorBuilder(_sparkViewEngine); }
protected override void beforeEach() { _viewEngine = new SparkViewEngine(); _settings = _viewEngine.Settings; Services.Inject <ISparkViewEngine>(_viewEngine); ClassUnderTest.Activate(Enumerable.Empty <IPackageInfo>(), MockFor <IPackageLog>()); }
public SparkResourceContentFetcher(ISparkSettings settings) { _settings = settings; _sparkViewEngine = new SparkViewEngine(_settings); _sparkViewEngine.ViewFolder = new FileSystemViewFolder(Path.Combine(AssmanConfiguration.Current.RootFilePath, "Views")); _descriptorBuilder = new DefaultDescriptorBuilder(_sparkViewEngine); }
/// <summary> /// Initializes a new instance of the <see cref="SparkViewEngine"/> class. /// </summary> public SparkViewEngine() { this.settings = (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); this.engine = new global::Spark.SparkViewEngine(this.settings) { DefaultPageBaseType = typeof(NancySparkView).FullName }; this.descriptorBuilder = new DefaultDescriptorBuilder(this.engine); }
public SparkViewFactory() { _splitsSettings = ((ISplitsSettings)ConfigurationManager.GetSection("splits")) ?? new SplitsSettings(); _settings = ((ISparkSettings)ConfigurationManager.GetSection("spark")) ?? new SparkSettings { PageBaseType = typeof(SplitsSparkView).FullName }; var services = SparkEngineStarter.CreateContainer(_settings); services.AddFilter(new SplitsSparkFilter()); Initialize(services); SparkEngineStarter.RegisterViewEngine(services); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <Http>().As <IHttp>().SingleInstance(); builder.RegisterType <PageGlimpseThumbnail>().As <IThumbnail>().SingleInstance(); builder.RegisterType <EventAggregator>().As <IEventAggregator>().SingleInstance(); builder.Register(c => new CacheManager(HttpRuntime.Cache)).As <ICacheManager>().SingleInstance(); builder.RegisterType <ExternalContentService>().As <IExternalContentService>().SingleInstance(); builder.RegisterType <GoogleSafeBrowsing>().As <IGoogleSafeBrowsing>().SingleInstance(); builder.RegisterType <UrlResolver>().As <IUrlResolver>().InstancePerLifetimeScope(); builder.RegisterType <UnitOfWork>().As <IUnitOfWork>().InstancePerLifetimeScope(); builder.RegisterType <UserService>().As <IUserService>().InstancePerLifetimeScope(); builder.RegisterType <ShortUrlService>().As <IShortUrlService>().InstancePerLifetimeScope(); builder.RegisterType <AdministrativeService>().As <IAdministrativeService>().InstancePerLifetimeScope(); builder.RegisterType <OpenIdRelyingParty>().As <IOpenIdRelyingParty>().InstancePerDependency(); builder.RegisterType <FormsAuthentication>().As <IFormsAuthentication>().SingleInstance(); builder.RegisterType <Cookie>().As <ICookie>().SingleInstance(); builder.RegisterAssemblyTypes(typeof(RepositoryBase <>).Assembly) .Where(type => type.Name.EndsWith("Repository")) .AsImplementedInterfaces() .InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(typeof(ISpamDetector).Assembly) .Where(type => type.IsClass && !type.IsAbstract && typeof(ISpamDetector).IsAssignableFrom(type)) .AsImplementedInterfaces() .InstancePerLifetimeScope(); builder.RegisterAssemblyTypes(typeof(IBackgroundService).Assembly) .Where(type => type.IsClass && !type.IsAbstract && typeof(IBackgroundService).IsAssignableFrom(type)) .AsImplementedInterfaces() .SingleInstance(); ISparkSettings sparkSettings = ConfigurationManager.GetSection("spark") as ISparkSettings; builder.RegisterInstance(sparkSettings).As <ISparkSettings>().SingleInstance(); Settings settings = CreateSettings(); builder.RegisterInstance(settings).As <Settings>().SingleInstance(); builder.Register(c => new BaseX(c.Resolve <Settings>().BaseType)).As <IBaseX>().SingleInstance(); ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["Shrinkr"]; string providerName = connectionStringSettings.ProviderName; string connectionString = connectionStringSettings.ConnectionString; builder.Register(c => new DatabaseFactory(providerName, connectionString)).As <IDatabaseFactory>().InstancePerLifetimeScope(); builder.Register(c => new QueryFactory(settings.BaseType == BaseType.BaseSixtyTwo)).As <IQueryFactory>().SingleInstance(); builder.RegisterType <CompressAttribute>().InstancePerDependency(); }
/// <summary> /// Initializes a new instance of the <see cref="SparkViewEngine"/> class. /// </summary> public SparkViewEngine(IRootPathProvider rootPathProvider, INancyEnvironment environment) { this.environment = environment; this.settings = (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); this.engine = new global::Spark.SparkViewEngine(this.settings) { DefaultPageBaseType = typeof(NancySparkView).FullName, BindingProvider = new NancyBindingProvider(rootPathProvider), }; this.descriptorBuilder = new DefaultDescriptorBuilder(this.engine); }
public SparkViewEngine(ISparkSettings settings) { Settings = settings ?? (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); if (Settings.DefaultLanguage == LanguageType.Oxygene) { SyntaxProvider = new OxygeneSyntaxProvider(Settings); } else { SyntaxProvider = new DefaultSyntaxProvider(Settings); } ViewActivatorFactory = new DefaultViewActivator(); }
protected override void beforeEach() { _viewEngine = new SparkViewEngine(); _settings = _viewEngine.Settings; var commonViewNamespaces = new CommonViewNamespaces(); commonViewNamespaces.Add("Foo"); commonViewNamespaces.Add("Bar"); Services.Inject(commonViewNamespaces); Services.Inject <ISparkViewEngine>(_viewEngine); ClassUnderTest.Activate(Enumerable.Empty <IPackageInfo>(), MockFor <IPackageLog>()); }
public SparkServiceContainer(ISparkSettings settings) { this._services = new Dictionary <Type, object>(); Dictionary <Type, Func <ISparkServiceContainer, object> > dictionary = new Dictionary <Type, Func <ISparkServiceContainer, object> >(); dictionary.Add(typeof(ISparkSettings), c => ConfigurationManager.GetSection("spark") ?? new SparkSettings()); dictionary.Add(typeof(ISparkViewEngine), c => new SparkViewEngine(c.GetService <ISparkSettings>())); dictionary.Add(typeof(ISparkLanguageFactory), c => new DefaultLanguageFactory()); dictionary.Add(typeof(ISparkSyntaxProvider), c => new DefaultSyntaxProvider(c.GetService <ISparkSettings>())); dictionary.Add(typeof(IViewActivatorFactory), c => new DefaultViewActivator()); dictionary.Add(typeof(IResourcePathManager), c => new DefaultResourcePathManager(c.GetService <ISparkSettings>())); dictionary.Add(typeof(ITemplateLocator), c => new DefaultTemplateLocator()); dictionary.Add(typeof(IBindingProvider), c => new DefaultBindingProvider()); dictionary.Add(typeof(IViewFolder), new Func <ISparkServiceContainer, object>(SparkServiceContainer.CreateDefaultViewFolder)); dictionary.Add(typeof(ICompiledViewHolder), c => new CompiledViewHolder()); this._defaults = dictionary; this._services[typeof(ISparkSettings)] = settings; }
/// <summary> /// Creates a spark IViewEngine with CSharp as the default language. /// </summary> /// <param name="settings">Typically an instance of SparkSettings object</param> /// <returns>An IViewEngine interface of the SparkViewFactory</returns> public static IViewEngine CreateViewEngine(ISparkSettings settings) { return CreateContainer(settings).GetService<IViewEngine>(); }
public SparkViewEngine(ISparkSettings settings) { this.Settings = settings ?? (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); }
public DefaultResourcePathManager(ISparkSettings settings) { _settings = settings; }
public static IViewFolder ApplySettings(this IViewFolder viewFolder, ISparkSettings settings) { return viewFolder; }
public SparkViewEngine(ISparkSettings settings) { Settings = settings ?? (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); SyntaxProvider = new DefaultSyntaxProvider(Settings); ViewActivatorFactory = new DefaultViewActivator(); }
public void Initialize(ISparkServiceContainer container) { _settings = container.GetService<ISparkSettings>(); Engine = container.GetService<ISparkViewEngine>(); CacheServiceProvider = container.GetService<ICacheServiceProvider>(); }
/// <summary> /// Installs the Spark+IronPython view engine. Settings passed in. /// </summary> public static void RegisterViewEngine(ISparkSettings settings) { ViewEngines.Engines.Add(CreateViewEngine(settings)); }
public SparkViewFactory(ISparkSettings settings) { Settings = settings ?? (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); }
public SparkViewFactory(ISparkSettings settings) { Settings = settings ?? (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); }
public SparkServiceContainer(ISparkSettings settings) { _services[typeof(ISparkSettings)] = settings; }
/// <summary> /// Installs the Spark view engine. Settings passed in. /// </summary> public static void RegisterViewEngine(MvcServer server, ISparkSettings settings) { server.ViewEngines.Add(CreateViewEngine(settings)); }
/// <summary> /// Installs the Spark view engine. Settings passed in. /// </summary> /// <param name="engines">Typically in the ViewEngines.Engines collection</param> /// <param name="settings">Typically an instance of SparkSettings object</param> public static void RegisterViewEngine(ICollection<IViewEngine> engines, ISparkSettings settings) { engines.Add(CreateViewEngine(settings)); }
public SparkViewFactory(ISparkSettings settings) : base(settings) { }
public SubFolderSupportedSparkViewFactory(ISparkSettings settings) { Settings = settings ?? (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); _customisedViewLocations = new List<string>(); }
/// <summary> /// Create a CSharp enabled service container with explicit spark settings. /// </summary> /// <param name="settings">Typically an instance of SparkSettings object</param> /// <returns>A configured service container. Additional service builders may /// me added. May be passed to RegisterViewEngine.</returns> public static ISparkServiceContainer CreateContainer(ISparkSettings settings) { var container = new SparkServiceContainer(settings); ConfigureContainer(container); return container; }
public CustomSyntaxProvider(ISparkSettings settings) : base(settings) { _grammar = new MarkupGrammar(settings); _releaseMode = !settings.Debug; }
/// <summary> /// Installs the Spark view engine. Settings passed in. /// </summary> public static void RegisterViewEngine(ISparkSettings settings) { ViewEngines.Engines.Add(CreateViewEngine(settings)); }
public SparkViewFactory(ISparkSettings settings, IServiceLocator serviceLocator) { Settings = settings ?? (ISparkSettings) ConfigurationManager.GetSection("spark") ?? new SparkSettings(); _serviceLocator = serviceLocator; }
public static IViewFolder ApplySettings(this IViewFolder viewFolder, ISparkSettings settings) { return(viewFolder); }
/// <summary> /// Installs the Spark+IronPython view engine. Settings passed in. /// </summary> /// <param name="engines">Typically in the ViewEngines.Engines collection</param> /// <param name="settings">Typically an instance of SparkSettings object</param> public static void RegisterViewEngine(ICollection <IViewEngine> engines, ISparkSettings settings) { engines.Add(CreateViewEngine(settings)); }
public SparkViewEngine(ISparkSettings settings) { Settings = settings ?? (ISparkSettings)ConfigurationManager.GetSection("spark") ?? new SparkSettings(); SyntaxProvider = new DefaultSyntaxProvider(Settings); ViewActivatorFactory = new DefaultViewActivator(); }
/// <summary> /// Installs the Spark view engine. Settings passed in. /// </summary> public static void RegisterViewEngine(MvcServer server, ISparkSettings settings) { server.ViewEngines.Add(CreateViewEngine(settings)); }
public DefaultResourcePathManager(ISparkSettings settings) { _settings = settings; }
/// <summary> /// Creates a spark IViewEngine with IronPython as the default language. /// </summary> /// <param name="settings">Typically an instance of SparkSettings object</param> /// <returns>An IViewEngine interface of the SparkViewFactory</returns> public static IViewEngine CreateViewEngine(ISparkSettings settings) { return(CreateContainer(settings).GetService <IViewEngine>()); }