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

C# IRootPathProvider类代码示例

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

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



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

示例1: DiagnosticsModuleBuilder

 public DiagnosticsModuleBuilder(IRootPathProvider rootPathProvider, IModelBinderLocator modelBinderLocator, INancyEnvironment diagnosticsEnvironment, INancyEnvironment environment)
 {
     this.rootPathProvider = rootPathProvider;
     this.serializerFactory = new DiagnosticsSerializerFactory(diagnosticsEnvironment);
     this.modelBinderLocator = modelBinderLocator;
     this.environment = environment;
 }
开发者ID:RadifMasud,项目名称:Nancy,代码行数:7,代码来源:DiagnosticsModuleBuilder.cs


示例2: DefaultDiagnostics

 /// <summary>
 /// Creates a new instance of the <see cref="DefaultDiagnostics"/> class.
 /// </summary>
 /// <param name="diagnosticsConfiguration"></param>
 /// <param name="diagnosticProviders"></param>
 /// <param name="rootPathProvider"></param>
 /// <param name="requestTracing"></param>
 /// <param name="configuration"></param>
 /// <param name="modelBinderLocator"></param>
 /// <param name="responseProcessors"></param>
 /// <param name="routeSegmentConstraints"></param>
 /// <param name="cultureService"></param>
 /// <param name="requestTraceFactory"></param>
 public DefaultDiagnostics(
     DiagnosticsConfiguration diagnosticsConfiguration,
     IEnumerable<IDiagnosticsProvider> diagnosticProviders,
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable<IResponseProcessor> responseProcessors,
     IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService,
     IRequestTraceFactory requestTraceFactory,
     IEnumerable<IRouteMetadataProvider> routeMetadataProviders)
 {
     this.diagnosticsConfiguration = diagnosticsConfiguration;
     this.diagnosticProviders = diagnosticProviders;
     this.rootPathProvider = rootPathProvider;
     this.requestTracing = requestTracing;
     this.configuration = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.routeMetadataProviders = routeMetadataProviders;
 }
开发者ID:csainty,项目名称:Nancy,代码行数:38,代码来源:DefaultDiagnostics.cs


示例3: Enable

        public static void Enable(IApplicationPipelines applicationPipelines, IRootPathProvider rootPathProvider, IStitchConfiguration configuration)
        {
            if (applicationPipelines == null)
            {
                throw new ArgumentNullException("applicationPipelines");
            }

            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (rootPathProvider == null)
            {
                throw new ArgumentNullException("rootPathProvider");
            }

            var compilerTypes =
                from type in AppDomainAssemblyTypeScanner.Types
                where typeof(ICompile).IsAssignableFrom(type)
                select type;

            var compilers = compilerTypes.Select(compiler => (ICompile) Activator.CreateInstance(compiler)).ToList();

            applicationPipelines.BeforeRequest.AddItemToStartOfPipeline(GetStitchResponse(compilers, rootPathProvider, configuration));
        }
开发者ID:nathanpalmer,项目名称:Nancy.Stitch,代码行数:26,代码来源:Stitch.cs


示例4: RenderExternalJavascript

 public static void RenderExternalJavascript(Stream responseStream, IRootPathProvider rootPath)
 {
     using (var js = new FileStream(Path.Combine(rootPath.GetRootPath(), "content/external.js"), FileMode.Open))
     {
         js.CopyTo(responseStream);
     }
 }
开发者ID:jdaigle,项目名称:CommentR,代码行数:7,代码来源:ResourcesModule.cs


示例5: LessModule

        public LessModule(IRootPathProvider root)
        {
            var urlPrefix = System.Configuration.ConfigurationManager.AppSettings["app:UrlPrefix"] ?? string.Empty;

            Get[urlPrefix + "/less/desktop"] = _ =>
            {
                var manifest = System.Configuration.ConfigurationManager.AppSettings["app:LessManifest"];
                if (manifest.StartsWith("/"))
                {
                    manifest = manifest.Substring(1);
                }

                manifest = manifest.Replace("/", "\\");

                var lessFile = Path.Combine(root.GetRootPath(), manifest);

                if (!File.Exists(lessFile))
                {
                    throw new FileNotFoundException("Less manifest was not found");
                }

                var less = File.ReadAllText(lessFile);

                var config = dotless.Core.configuration.DotlessConfiguration.GetDefaultWeb();
                config.Logger = typeof(dotless.Core.Loggers.AspResponseLogger);
                config.CacheEnabled = false;
                config.MinifyOutput = true;
                var css = dotless.Core.LessWeb.Parse(less, config);

                return Response.AsText(css, "text/css");
            };
        }
开发者ID:joakimjm,项目名称:eziou,代码行数:32,代码来源:LessModule.cs


示例6: ConfigureContainer

        private static TinyIoCContainer ConfigureContainer(IModuleKeyGenerator moduleKeyGenerator, IEnumerable<IDiagnosticsProvider> providers, IRootPathProvider rootPathProvider, IRequestTracing requestTracing, NancyInternalConfiguration configuration, DiagnosticsConfiguration diagnosticsConfiguration)
        {
            var diagContainer = new TinyIoCContainer();

            diagContainer.Register<IModuleKeyGenerator>(moduleKeyGenerator);
            diagContainer.Register<IInteractiveDiagnostics, InteractiveDiagnostics>();
            diagContainer.Register<IRequestTracing>(requestTracing);
            diagContainer.Register<IRootPathProvider>(rootPathProvider);
            diagContainer.Register<NancyInternalConfiguration>(configuration);
            diagContainer.Register<IModelBinderLocator, DefaultModelBinderLocator>();
            diagContainer.Register<IBinder, DefaultBinder>();
            diagContainer.Register<IFieldNameConverter, DefaultFieldNameConverter>();
            diagContainer.Register<BindingDefaults, BindingDefaults>();
            diagContainer.Register<ISerializer, DefaultJsonSerializer>();
            diagContainer.Register<DiagnosticsConfiguration>(diagnosticsConfiguration);

            foreach (var diagnosticsProvider in providers)
            {
                diagContainer.Register<IDiagnosticsProvider>(diagnosticsProvider, diagnosticsProvider.GetType().FullName);
            }

            foreach (var moduleType in AppDomainAssemblyTypeScanner.TypesOf<DiagnosticModule>().ToArray())
            {
                diagContainer.Register(typeof(NancyModule), moduleType, moduleKeyGenerator.GetKeyForModuleType(moduleType)).AsMultiInstance();
            }

            return diagContainer;
        }
开发者ID:rhwy,项目名称:Nancy,代码行数:28,代码来源:DiagnosticsModuleCatalog.cs


示例7: CachedFeedService

 public CachedFeedService(IConfigSettings configSettings, IRootPathProvider rootPathProvider)
 {
     this.rootPathProvider = rootPathProvider;
     cacheMinutes = configSettings.GetAppSetting<int>("cacheminutes");
     nancyCategories = configSettings.GetAppSetting("nancycategories")
         .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
 }
开发者ID:NancyFx,项目名称:Nancy.Blog,代码行数:7,代码来源:CachedFeedService.cs


示例8: DefaultResponseFormatter

 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultResponseFormatter"/> class.
 /// </summary>
 /// <param name="rootPathProvider">The <see cref="IRootPathProvider"/> that should be used by the instance.</param>
 /// <param name="context">The <see cref="NancyContext"/> that should be used by the instance.</param>
 /// <param name="serializerFactory">An <see cref="ISerializerFactory" /> instance"/>.</param>
 /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param>
 public DefaultResponseFormatter(IRootPathProvider rootPathProvider, NancyContext context, ISerializerFactory serializerFactory, INancyEnvironment environment)
 {
     this.rootPathProvider = rootPathProvider;
     this.context = context;
     this.serializerFactory = serializerFactory;
     this.environment = environment;
 }
开发者ID:RadifMasud,项目名称:Nancy,代码行数:14,代码来源:DefaultResponseFormatter.cs


示例9: XmlFormatterExtensionsFixtures

 public XmlFormatterExtensionsFixtures()
 {
     this.rootPathProvider = A.Fake<IRootPathProvider>();
     this.responseFormatter = new DefaultResponseFormatter(this.rootPathProvider);
     this.model = new Person { FirstName = "Andy", LastName = "Pike" };
     this.response = this.responseFormatter.AsXml(model);
 }
开发者ID:nathanpalmer,项目名称:Nancy,代码行数:7,代码来源:XmlFormatterExtensionsFixtures.cs


示例10: ViewNotFoundException

 /// <summary>
 /// Initializes a new instance of the <see cref="ViewNotFoundException"/>.
 /// </summary>
 /// <param name="viewName">The name of the view that was being located.</param>
 /// <param name="availableViewEngineExtensions">List of available view extensions that can be rendered by the available view engines.</param>
 /// <param name="inspectedLocations">The locations that were inspected for the view.</param>
 /// <param name="rootPathProvider">An <see cref="IRootPathProvider"/> instance.</param>
 public ViewNotFoundException(string viewName, string[] availableViewEngineExtensions, string[] inspectedLocations, IRootPathProvider rootPathProvider)
 {
     this.rootPathProvider = rootPathProvider;
     this.ViewName = viewName;
     this.AvailableViewEngineExtensions = availableViewEngineExtensions;
     this.InspectedLocations = inspectedLocations;
 }
开发者ID:RobertTheGrey,项目名称:Nancy,代码行数:14,代码来源:ViewNotFoundException.cs


示例11: WebHost

 public WebHost(IRootPathProvider rootPathProvider, Func<NancyContext> getContext)
 {
   this.rootPathProvider = rootPathProvider;
   this.getContext = getContext;
   this.logger = NLog.LogManager.GetCurrentClassLogger();
   logger.Debug("WebHost.ctor: constructed!");
 }
开发者ID:ChrisMH,项目名称:Cassette.Nancy,代码行数:7,代码来源:WebHost.cs


示例12: InfoModel

        public InfoModel(IRootPathProvider rootPathProvider, NancyInternalConfiguration configuration)
        {
            this.rootPathProvider = rootPathProvider;

            Configuration = new Dictionary<string, IEnumerable<string>>();
            foreach (var propertyInfo in configuration.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                var value = propertyInfo.GetValue(configuration, null);

                Configuration[propertyInfo.Name] = (!typeof(IEnumerable).IsAssignableFrom(value.GetType())) ?
                    new[] { value.ToString() } :
                    ((IEnumerable<object>)value).Select(x => x.ToString());
            }

            var properties = SettingTypes
                .SelectMany(t => t.GetProperties(BindingFlags.Static | BindingFlags.Public))
                .Where(x => x.PropertyType == typeof(bool));

            Settings = from property in properties
                       orderby property.Name
                       let value = (bool)property.GetValue(null, null)
                       select new SettingsModel
                       {
                           Name = Regex.Replace(property.Name, "[A-Z]", " $0"),
                           Value = value
                       };
        }
开发者ID:jchannon,项目名称:Glimpse.Nancy,代码行数:27,代码来源:InfoModel.cs


示例13: ConnectionManager

        public ConnectionManager(IRootPathProvider rootPathProvider)
        {
            this.factory = DbProviderFactories.GetFactory("System.Data.SQLite");
            this.databaseName = Path.Combine(rootPathProvider.GetRootPath(), "data.db");

            CreateDatabase();
        }
开发者ID:jchannon,项目名称:Glimpse.Nancy,代码行数:7,代码来源:ConnectionManager.cs


示例14: InfoModule

        public InfoModule(IRootPathProvider rootPathProvider, NancyInternalConfiguration configuration)
            : base("/info")
        {
            Get["/"] = _ => View["Info"];

            Get["/data"] = _ =>
            {
                dynamic data = new ExpandoObject();

                data.Nancy = new ExpandoObject();
                data.Nancy.Version = string.Format("v{0}", this.GetType().Assembly.GetName().Version.ToString());
                data.Nancy.CachesDisabled = StaticConfiguration.DisableCaches;
                data.Nancy.TracesDisabled = StaticConfiguration.DisableErrorTraces;
                data.Nancy.CaseSensitivity = StaticConfiguration.CaseSensitive ? "Sensitive" : "Insensitive";
                data.Nancy.RootPath = rootPathProvider.GetRootPath();
                data.Nancy.Hosting = this.GetHosting();
                data.Nancy.BootstrapperContainer = this.GetBootstrapperContainer();
                data.Nancy.LocatedBootstrapper = NancyBootstrapperLocator.Bootstrapper.GetType().ToString();
                data.Nancy.LoadedViewEngines = GetViewEngines();

                data.Configuration = new Dictionary<string, object>();
                foreach (var propertyInfo in configuration.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
                {
                    var value =
                        propertyInfo.GetValue(configuration, null);

                    data.Configuration[propertyInfo.Name] = (!typeof(IEnumerable).IsAssignableFrom(value.GetType())) ?
                        new[] { value.ToString() } :
                        ((IEnumerable<object>) value).Select(x => x.ToString());
                }

                return Response.AsJson((object)data);
            };
        }
开发者ID:RobertTheGrey,项目名称:Nancy,代码行数:34,代码来源:InfoModule.cs


示例15: ConfigureContainer

        private static TinyIoCContainer ConfigureContainer(IEnumerable<IDiagnosticsProvider> providers, IRootPathProvider rootPathProvider, IRequestTracing requestTracing, NancyInternalConfiguration configuration, INancyEnvironment diagnosticsEnvironment)
        {
            var diagContainer = new TinyIoCContainer();

            diagContainer.Register<IInteractiveDiagnostics, InteractiveDiagnostics>();
            diagContainer.Register<IRequestTracing>(requestTracing);
            diagContainer.Register<IRootPathProvider>(rootPathProvider);
            diagContainer.Register<NancyInternalConfiguration>(configuration);
            diagContainer.Register<IModelBinderLocator, DefaultModelBinderLocator>();
            diagContainer.Register<IBinder, DefaultBinder>();
            diagContainer.Register<IFieldNameConverter, DefaultFieldNameConverter>();
            diagContainer.Register<BindingDefaults, BindingDefaults>();
            diagContainer.Register<INancyEnvironment>(diagnosticsEnvironment);
            diagContainer.Register<ISerializer>(new DefaultJsonSerializer(diagnosticsEnvironment));

            foreach (var diagnosticsProvider in providers)
            {
                var key = string.Concat(
                    diagnosticsProvider.GetType().FullName,
                    "_",
                    diagnosticsProvider.DiagnosticObject.GetType().FullName);

                diagContainer.Register<IDiagnosticsProvider>(diagnosticsProvider, key);
            }

            foreach (var moduleType in AppDomainAssemblyTypeScanner.TypesOf<DiagnosticModule>().ToArray())
            {
                diagContainer.Register(typeof(INancyModule), moduleType, moduleType.FullName).AsMultiInstance();
            }

            return diagContainer;
        }
开发者ID:l3m,项目名称:Nancy,代码行数:32,代码来源:DiagnosticsModuleCatalog.cs


示例16: ArticleModule

        /// <summary>
        /// Initializes a new instance of the <see cref="ArticleModule" />.
        /// </summary>
        /// <param name="repository">The article's repository</param>
        public ArticleModule(IApplication application, IArticleRepository articleRepository, IRootPathProvider rootPathProvider)
            : base(application)
        {
            this._ArticleRepository = articleRepository;
            this._RootPathProvider = rootPathProvider;

            // Bind the HTTP GET verb to the ListArticles method
            this.Get["/articles"] = ListArticles;

            // Bind the HTTP GET verb to the ListHomeArticles method
            this.Get["/articles/homeArticles"] = ListHomeArticles;

            // Bind the HTTP GET verb to the ListSliderArticles method
            this.Get["/articles/sliderArticles"] = ListSliderArticles;

            // Define a route for urls "/articles/{seoTitle}" which will returns the article matching the specified slug
            this.Get["/articles/{seoTitle}"] = GetArticle;

            // Define a route for urls "/article/{seoTitle}" which will returns the article matching the specified slug
            this.Get["/article/apercu/{seoTitle}"] = GetArticleBySeoTitle;

            // Define a route for urls "/article/{seoTitle}" which will returns the article matching the specified slug
            this.Get["/article/{seoTitle}"] = GetArticleBySeoTitle;

            // Define a route for urls "/articles/byId" which will returns the article matching the specified id
            this.Get["/articles/articles/byId"] = GetArticlebyId;

            // Bind the HTTP GET verb to the ListEvents method
            this.Get["/actualites/actualites"] = ListPublicArticles;
        }
开发者ID:qginformatique,项目名称:GMATechProject,代码行数:34,代码来源:ArticleModule.cs


示例17: DocsModule

        public DocsModule(IRootPathProvider rootPathProvider)
            : base("api-docs")
        {
            _rootPathProvider = rootPathProvider;

            Get["/"] = Index;
        }
开发者ID:jroliveira,项目名称:url-shortener,代码行数:7,代码来源:DocsModule.cs


示例18: RazorViewEngineFixture

        public RazorViewEngineFixture()
        {
            this.configuration = A.Fake<IRazorConfiguration>();
            this.engine = new RazorViewEngine(this.configuration);

            var cache = A.Fake<IViewCache>();
            A.CallTo(() => cache.GetOrAdd(A<ViewLocationResult>.Ignored, A<Func<ViewLocationResult, Func<NancyRazorViewBase>>>.Ignored))
                .ReturnsLazily(x =>
                {
                    var result = x.GetArgument<ViewLocationResult>(0);
                    return x.GetArgument<Func<ViewLocationResult, Func<NancyRazorViewBase>>>(1).Invoke(result);
                });

            this.renderContext = A.Fake<IRenderContext>();
            A.CallTo(() => this.renderContext.ViewCache).Returns(cache);
            A.CallTo(() => this.renderContext.LocateView(A<string>.Ignored, A<object>.Ignored))
                .ReturnsLazily(x =>
                {
                    var viewName = x.GetArgument<string>(0);
                    return FindView(viewName); ;
                });

            this.rootPathProvider = A.Fake<IRootPathProvider>();
            A.CallTo(() => this.rootPathProvider.GetRootPath()).Returns(Path.Combine(Environment.CurrentDirectory, "TestViews"));

            this.fileSystemViewLocationProvider = new FileSystemViewLocationProvider(this.rootPathProvider, new DefaultFileSystemReader());
        }
开发者ID:GraemeF,项目名称:Nancy,代码行数:27,代码来源:RazorViewEngineFixture.cs


示例19: FaceModule

        public FaceModule(IRootPathProvider pathProvider)
        {
            Post["/api/face/upload", true] = async (parameters, ct) =>
            {
                var file = this.Request.Files.FirstOrDefault();

                if (file == null)
                    return HttpStatusCode.BadRequest;

                var faceService = new Pubhack4.Services.Face.FaceService();
                var faces = await faceService.GetFacesFromImage(file.Value);

                return Response.AsJson(faces);
            };

            Post["/api/face/base64", true] = async (parameters, ct) =>
            {
                string x = Context.Request.Form["image"];

                var data = System.Convert.FromBase64String(x.Split(',')[1]);

                if (data == null)
                    return HttpStatusCode.BadRequest;

                var ms = new MemoryStream(data, 0, data.Length);

                var faceService = new Pubhack4.Services.Face.FaceService();
                var faces = await faceService.GetFacesFromImage(ms);

                return Response.AsJson(faces);
            };
        }
开发者ID:moov2,项目名称:pubhack4,代码行数:32,代码来源:FaceModule.cs


示例20: DefaultDiagnostics

 /// <summary>
 /// Creates a new instance of the <see cref="DefaultDiagnostics"/> class.
 /// </summary>
 /// <param name="diagnosticProviders"></param>
 /// <param name="rootPathProvider"></param>
 /// <param name="requestTracing"></param>
 /// <param name="configuration"></param>
 /// <param name="modelBinderLocator"></param>
 /// <param name="responseProcessors"></param>
 /// <param name="routeSegmentConstraints"></param>
 /// <param name="cultureService"></param>
 /// <param name="requestTraceFactory"></param>
 /// <param name="routeMetadataProviders"></param>
 /// <param name="textResource"></param>
 /// <param name="environment"></param>
 /// <param name="typeCatalog"></param>
 public DefaultDiagnostics(
     IEnumerable<IDiagnosticsProvider> diagnosticProviders,
     IRootPathProvider rootPathProvider,
     IRequestTracing requestTracing,
     NancyInternalConfiguration configuration,
     IModelBinderLocator modelBinderLocator,
     IEnumerable<IResponseProcessor> responseProcessors,
     IEnumerable<IRouteSegmentConstraint> routeSegmentConstraints,
     ICultureService cultureService,
     IRequestTraceFactory requestTraceFactory,
     IEnumerable<IRouteMetadataProvider> routeMetadataProviders,
     ITextResource textResource,
     INancyEnvironment environment,
     ITypeCatalog typeCatalog)
 {
     this.diagnosticProviders = diagnosticProviders;
     this.rootPathProvider = rootPathProvider;
     this.requestTracing = requestTracing;
     this.configuration = configuration;
     this.modelBinderLocator = modelBinderLocator;
     this.responseProcessors = responseProcessors;
     this.routeSegmentConstraints = routeSegmentConstraints;
     this.cultureService = cultureService;
     this.requestTraceFactory = requestTraceFactory;
     this.routeMetadataProviders = routeMetadataProviders;
     this.textResource = textResource;
     this.environment = environment;
     this.typeCatalog = typeCatalog;
 }
开发者ID:VPashkov,项目名称:Nancy,代码行数:45,代码来源:DefaultDiagnostics.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IRoute类代码示例发布时间:2022-05-24
下一篇:
C# IRoom类代码示例发布时间: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