cja*_*ues 15 asp.net web-config dotless
无点文档非常有限.我找不到关于configsection选项的任何信息 - 特别是"web"属性的功能.
任何人都可以开导我吗?
Kev*_*ain 19
代码通常是开源项目的相当好的文档;)
抓住代码的副本并查看dotless.Core> configuration> DotlessConfiguration.cs你会看到一些关于所有配置元素的方便评论 - 这是Web的一个
/// <summary>
/// Whether this is used in a web context or not
/// </summary>
public bool Web { get; set; }
Run Code Online (Sandbox Code Playgroud)
不可否认,它并没有告诉你很多,但找到了对该属性的引用,并且你在代码中只遇到一个地方 -
if (!configuration.Web)
RegisterLocalServices(pandora);
Run Code Online (Sandbox Code Playgroud)
这开始给你一个更好的线索,它是做什么的
protected virtual void RegisterLocalServices(FluentRegistration pandora)
{
pandora.Service<ICache>().Implementor<InMemoryCache>();
pandora.Service<IParameterSource>().Implementor<ConsoleArgumentParameterSource>();
pandora.Service<ILogger>().Implementor<ConsoleLogger>().Parameters("level").Set("error-level");
pandora.Service<IPathResolver>().Implementor<RelativePathResolver>();
}
Run Code Online (Sandbox Code Playgroud)
因此它设置在内存缓存,登录到控制台等(即,如果不在Web上下文中,它使用的服务)