本文整理汇总了C#中IRootPathProvider类的典型用法代码示例。如果您正苦于以下问题:C# IRootPathProvider类的具体用法?C# IRootPathProvider怎么用?C# IRootPathProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRootPathProvider类属于命名空间,在下文中一共展示了IRootPathProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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));
}
示例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);
}
}
示例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");
};
}
示例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;
}
示例7: CachedFeedService
public CachedFeedService(IConfigSettings configSettings, IRootPathProvider rootPathProvider)
{
this.rootPathProvider = rootPathProvider;
cacheMinutes = configSettings.GetAppSetting<int>("cacheminutes");
nancyCategories = configSettings.GetAppSetting("nancycategories")
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}
示例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;
}
示例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);
}
示例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;
}
示例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!");
}
示例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
};
}
示例13: ConnectionManager
public ConnectionManager(IRootPathProvider rootPathProvider)
{
this.factory = DbProviderFactories.GetFactory("System.Data.SQLite");
this.databaseName = Path.Combine(rootPathProvider.GetRootPath(), "data.db");
CreateDatabase();
}
示例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);
};
}
示例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;
}