我已经从master创建了一个分支xyz.我做了大约1000次提交,可能修改了xyz分支中的20个文件.现在我想列出我在xyz分支中修改过的所有文件.
以下命令列出在两个分支中修改的文件.
git diff --name-only master...xyz
Run Code Online (Sandbox Code Playgroud) 我正在试图弄清楚如何使用Entity Framework Cores 2.1新的ChangeTracker.Tracked事件来挂钩阅读查询.不幸的是,我无法理解如何实现这一点.由于它是一项新功能,因此无法在其上找到任何文章,官方Microsoft文档网站也不提供任何帮助或示例代码.我的场景非常简单.我有一个包含以下列的数据库: id,customerId,metadata. 当用户查询此表时,我想拦截查询结果集,对于每一行,我想将customerId与当前登录的用户进行比较.我希望ChangeTracker.Tracked事件可以帮助我拦截返回结果集.我正在寻找一些关于如何实现上述的示例代码.
我有一个很大的文本,我想显示它。我为此使用了一个标签。但这个标签不显示全文。我想要这个标签的垂直滚动。
Grid mainGrid = new Grid
{
HeightRequest = 40,
BackgroundColor = Color.White,
Padding = 20,
RowDefinitions =
{
new RowDefinition { Height = new GridLength(25, GridUnitType.Star) },//0 Title
new RowDefinition { Height = new GridLength(5, GridUnitType.Star) },//1 Line
new RowDefinition { Height = new GridLength(50, GridUnitType.Star) },//2 This is for MessageLabel
new RowDefinition { Height = new GridLength(20, GridUnitType.Star) },//3 OK-Cancel
}
};
MessageLabel = new Label
{
FontAttributes = FontAttributes.None,
FontSize = 18,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = …
Run Code Online (Sandbox Code Playgroud) 我必须调用参数为char
和 的存储过程VarBinary(MAX)
。我需要使用 Dapper 从 C# 代码调用此存储过程。但我找不到 dapper 支持的任何参数。
SP:
ALTER PROCEDURE [dbo].[uspTest]
, @Param1 CHAR(1)
, @Param2 VARBINARY(MAX)=null
Run Code Online (Sandbox Code Playgroud)
C#:
DynamicParameters parameter = new DynamicParameters();
parameter.Add("@Param1", email.SenderType, DbType.char, ParameterDirection.Input);
parameter.Add("@Param2", email.AttachedFileStream, DbType.varbinary, ParameterDirection.Input);
Run Code Online (Sandbox Code Playgroud)
编译错误:
DBType 不包含 char 和 varbinary 的定义
我有类似的东西
var a = new object[2]
{
new double[1] { 0.5 },
new double[1] { 0.5 }
}
Run Code Online (Sandbox Code Playgroud)
我想把它投射到double[][]
. 我尝试过(double[][])a
,a.Cast<double[][]>()
但没成功
我有一个对象列表.我想将这些项添加到ListView.我试图逐行添加每个列表项但格式非常糟糕,它应该是正确的表类型格式.
List<string> lst = new List<string>();
lst.Add("John dsfsfsdfs " + "1" + 100);
lst.Add("Smith sdfsdfsdfs" + "2" + 120);
lst.Add("Cait dsffffffffffffffffffffff" + "3" + 97);
lst.Add("Irene" + "4" + 100);
lst.Add("Ben" + "5" + 100);
lst.Add("Deniel jjhkh " + "6" + 88);
foreach(string pl in lst)
{
listView1.Items.Add(pl);
}
Run Code Online (Sandbox Code Playgroud)
项目不可见,应采用适当的格式.
运行测试时出现错误。我该如何解决这个问题?
public class TestAppService : TestAppServiceBase, ITestAppService
{
private readonly ITestRepository _testRepository;
public TestAppService(ITestRepository testRepository)
{
_testRepository = testRepository;
}
}
public class TestAppService_Test : TestAppServiceTestBase
{
private readonly ITestAppService _testAppService;
public TestAppService_Test()
{
_testAppService = Resolve<ITestAppService>();
}
}
Run Code Online (Sandbox Code Playgroud)
存储库:
public class TestRepository : TestRepositoryBase<Test, int>, ITestRepository
{
private readonly IActiveTransactionProvider _transactionProvider;
public TestRepository(IDbContextProvider<TestDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public TestRepository(IDbContextProvider<TestDbContext> dbContextProvider,
IActiveTransactionProvider transactionProvider, IObjectMapper objectMapper)
: base(dbContextProvider)
{
_transactionProvider = transactionProvider;
ObjectMapper = objectMapper;
}
}
public interface ITestRepository …
Run Code Online (Sandbox Code Playgroud) 我正在实施自定义内容下拉列表。工作不正常。它不设置selectedTestType
值,而是undefined
在onChangeTestTypes
.
<p-dropdown name="classTestTypeCombobox"
[options]="TestTypes" [(ngModel)]="selectedTestType"
[style]="{'width':'150px'}" filter="filter"
[disabled]="this.isProdCodeDisabled"
appendTo="body"
required
#classTestTypeCombobox="ngModel"
(ngModelChange)="onChangeTestTypes($event)">
<ng-template let-TestType pTemplate="item">
<div class="ui-helper-clearfix" style="position: relative;height: 25px;">
<div>{{TestType.descLong}}</div>
</div>
</ng-template>
</p-dropdown>
Run Code Online (Sandbox Code Playgroud)
TestTypes
是一个类对象数组,它有以下成员。
id: number;
classificationCode: string;
descLong: string;
classificationParent: string;
codeType: number;
onChangeTestTypes(TestType) {
this.selectedTestTypeDesc = this.TestTypes.filter(x => x.priceCode == TestType)[0].descLong;
this.price.Type = this.TestTypes.filter(x => x.priceCode == TestType)[0].Type;
}
Run Code Online (Sandbox Code Playgroud) 我在 appsettings.json 文件中定义了一个连接字符串。现在我想在我的 TextDBConext 文件中读取它,我该怎么做?
public class TestContext: DbContext
{
public DbSet<TestTable> TestTable { get; set; }
public TestContext()
{
}
public IConfiguration Configuration { get; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Connection string"); //I have hardcoded here, but I want from appsettings.json
}
}
Run Code Online (Sandbox Code Playgroud)
Appsettings.json 文件:
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"connection_string": "Connection String"
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个 Azure 函数,其中包含以下代码行:
Console.WriteLine("Name: " + list.Count());
Run Code Online (Sandbox Code Playgroud)
此行有时会引发此异常:
句柄无效。
在 Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor
+d__26.MoveNext (Microsoft. Azure.WebJobs.Host,版本=3.0.34.0,文化=中性,PublicKeyToken=31bf3856ad364e35:C:\项目\ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ FunctionExecutor.cs:352 )
在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib,版本=4.0.0.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e)在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib,版本) =4.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e)在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Private.CoreLib,版本=4.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e)在System.Runtime.CompilerServices Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor+d__18.MoveNext (Microsoft.Azure.WebJobs.主机,版本=3.0.34.0,文化=中性,PublicKeyToken=31bf3856ad364e35:C:\项目\ azure-webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Executors \ FunctionExecutor.cs:108)内部异常系统.IO.IOException 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw 处理:在 System.ConsolePal+WindowsConsoleStream.Write(System.Console,版本=4.1.2.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a)在 System.IO.StreamWriter。刷新(System.Private.CoreLib,版本=4.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e)在System.IO.StreamWriter.WriteLine(System.Private.CoreLib,版本=4.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e) )在System.IO.TextWriter + SyncTextWriter.WriteLine(System.Private.CoreLib,版本= 4.0.0.0,文化=中性,PublicKeyToken = 7cec85d7bea7798e)在System.Console.WriteLine(System.Console,版本= 4.1.2.0,文化=中性,PublicKeyToken = b03f5f7f11d50a3a)
我们应该忽略这一点还是不要在 Azure 函数中使用控制台类?