我在 .net5 (又名)中有一个 Azure 函数dotnet-isolated
,并且我添加了这样的实体框架
services.AddDbContext<EfDbContext>(options =>
{
options.UseSqlServer(context.Configuration[...], builder =>
{
builder.EnableRetryOnFailure();
});
});
Run Code Online (Sandbox Code Playgroud)
当我运行该函数时,我在控制台中看到来自 EF 的数据库查询(根据颜色判断信息级别)。
我怎样才能禁用它们?我在我的中尝试了明显的选项host.json
:
"logging": {
"logLevel": {
"Microsoft.EntityFrameworkCore": "Warning",
}
}
Run Code Online (Sandbox Code Playgroud)
和
"logging": {
"logLevel": {
"default": "Information",
"Microsoft.EntityFrameworkCore": "Warning",
"Microsoft.EntityFrameworkCore.Database": "Warning",
"Microsoft.EntityFrameworkCore.Query": "Warning"
}
}
Run Code Online (Sandbox Code Playgroud)
甚至
"logging": {
"logLevel": {
"Microsoft": "Warning",
}
}
Run Code Online (Sandbox Code Playgroud)
但这没有帮助。唯一有效的选择是
"logging": {
"logLevel": {
"default": "Warning",
}
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
如果我在下面运行,请评论在 ember 中生成组件。
$ ember generate component my-new<br>
installing component<br>
create app\components\my-new.hbs<br>
**skip app/components/my-new.js<br>**
tip to add a class, run ember generate component-class my-new <br>
installing component-test <br>
create tests\integration\components\my-new-test.js<br>
Run Code Online (Sandbox Code Playgroud)
它不会同时创建 componentName.js 和模板文件。怎么解决呢?
我有一个非常简单的方法,它查询数据库并返回一个值.代码如下:
public List<int?> TravelTime()
{
List<int?> items = new List<int?>();
Induction induction = new Induction();
using (var dbContext = new MyEntites())
{
var query = dbContext.MyTable.Select(a => a.Travel_Time).Take(1);
foreach (var item in query)
{
induction.TravelTime = item;
items.Add(induction.TravelTime);
}
}
return items;// Value here is 8
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用以下代码对此方法进行单元测试:
[TestMethod]
public void Check_Travel_Time_Test()
{
//Arrange
InductionView vModel = new InductionView();
Induction induction = new Induction();
List<int?> actual = new List<int?>();
induction.TravelTime = 8;
actual.Add(induction.TravelTime);
//Act
var expected = vModel.TravelTime();
//Assert
Assert.AreEqual(expected, …
Run Code Online (Sandbox Code Playgroud) 有一个预定义的营销模板,模板的相关部分如下所示:
嗨 [%first_name | 亲爱的粉丝%],xxxxxx
sendgrid 模板变量替换有很多不同的语法,这非常令人困惑。例如,我见过 [%variable_name%]、{{variable_name}}、-variable_name- 和 <%variable_name%>
如何将替换/个性化/模板数据(只是列出我见过的似乎指代同一事物的不同名称)从 C# 客户端传递到模板?