我需要在控制台应用程序运行时更改 appsettings.json 。我用来加载 appsettings.json 的代码仅在启动时加载 appsettings.json 并且一旦应用程序运行它就不会刷新。有人可以帮我解决这个问题吗?
public IConfigurationRoot GetAppssetingsConfig()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables();
IConfigurationRoot configuration = builder.Build();
configuration.Reload();
return configuration;
}
Run Code Online (Sandbox Code Playgroud)
我期望的是,每次调用上述函数时,它都会读取当时的 appsettings.json,但这并没有发生。感谢帮助
我遇到了一个奇怪的(?)问题,我已经实现了BroadcastReceiver,USER_PRESENT它在我的平板电脑上工作正常,但在我的 Galaxy S 上,它被触发两次,有人可以在这里解释一下吗?
<receiver android:name="XYZBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT"/>
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
我在onReceive方法中有一个简单的语句,它打印了两次,在 logcat 中我也看到以下两次:
11-23 17:36:35.603: INFO/Launcher(2632): ACTION_USER_PRESENT
Run Code Online (Sandbox Code Playgroud) 我有datagridview填充数据库中的数据,有些列我在其中有日期和时间"MMddyyyy"和"hhmmss"格式,我想要做的是当datagridview加载时,我想将此格式更改为其他格式比如,dd-MM-yy用于日期和时间hh-mm-ss.我想知道是否有人可以指导我如何做到这一点.我无法通过gridview.columns [x] .defaultcellstyle.format ="dd-MM-yy"用上面的方法做到这一点我没有得到任何错误但在gridview上没有任何改变...
谢谢
注意:我也没有选择更改数据库中的列长度.. :-(没有语法问题
我无法想出语法来按联合顺序获取结果。我所追求的是,如果第一个并集有结果,它必须出现在第一个,如果第二个并集有结果,它必须出现在第二个,依此类推。
select a.id, a.id2
from Table1 a
where a.id3=(select c1.id1 from table c1 where c1.name='A') --Must be first result
UNION
select distinct a.id, a.id2
from Table1 a
where a.id3=(select c2.id2 from table c2 where c2.name='B')--Must be second result (if exists)
UNION
select distinct a.id, a.id2
from Table1 a
where a.id3=(select c3.id3 from table c3 where c3.name='C')--Must be 3rd result (if exists)
Run Code Online (Sandbox Code Playgroud)
现在,如果第二个联盟没有结果,则第三个联盟将是第二个。有人可以指导吗?