public CassetteStartup(IRootPathProvider rootPathProvider)
        {
            this.rootPathProvider = rootPathProvider;

            // This will trigger creation of the Cassette infrastructure at the time of the first request.
            // The virtual directory is not known until that point, and the virtual directory is required for creation.
            this.getApplication = InitializeApplication;
            CassetteApplicationContainer.SetApplicationAccessor(() => getApplication());

            routeGenerator = new CassetteRouteGenerator(rootPathProvider.GetRootPath(), GetCurrentContext);
        }
        public CassetteApplication(IBundleContainer bundleContainer, CassetteSettings settings,
                                   CassetteRouteGenerator routeHandling, Func <NancyContext> getCurrentContext)
            : base(bundleContainer, settings)
        {
            if (getCurrentContext == null)
            {
                throw new ArgumentNullException("getCurrentContext");
            }
            this.getCurrentContext = getCurrentContext;

            routeHandling.InstallCassetteRouteHandlers(bundleContainer);
        }
示例#3
0
 public CassetteApplicationContainerFactory(ICassetteConfigurationFactory cassetteConfigurationFactory,
                                            CassetteConfigurationSection configurationSection,
                                            string physicalDirectory,
                                            string virtualDirectory,
                                            bool isDebuggingEnabled,
                                            Func <NancyContext> getCurrentContext,
                                            CassetteRouteGenerator routeGenerator)
     : base(cassetteConfigurationFactory, configurationSection, physicalDirectory, virtualDirectory)
 {
     this.configurationSection = configurationSection;
     this.physicalDirectory    = physicalDirectory;
     this.virtualDirectory     = virtualDirectory;
     this.isDebuggingEnabled   = isDebuggingEnabled;
     this.getCurrentContext    = getCurrentContext;
     this.routeGenerator       = routeGenerator;
 }