我试图从我的quartz.net计划工作中调用webapi方法.我不确定我的做法是否正确?如果这是正确的方法或者有更好的方法可以帮助任何人吗?
MethodRepository.cs
public async Task<IEnumerable<ResultClass>> GetResult(string queryCriteria)
{
return await _httpClient.Get(queryCriteria);
}
Run Code Online (Sandbox Code Playgroud)
石英工作:
public async void Execute(IJobExecutionContext context)
{
var results= await _repo.GetResult();
}
Run Code Online (Sandbox Code Playgroud)
通用Httpclient:
public async Task<IEnumerable<T>> Get(string queryCriteria)
{
_addressSuffix = _addressSuffix + queryCriteria;
var responseMessage = await _httpClient.GetAsync(_addressSuffix);
responseMessage.EnsureSuccessStatusCode();
return await responseMessage.Content.ReadAsAsync<IEnumerable<T>>();
}
Run Code Online (Sandbox Code Playgroud)
但石英文档说我不能在石英作业中使用异步方法.那么Web API方法怎么样呢?
我可以将quartz作业执行方法更改为:
public void Execute(IJobExecutionContext context)
{
var result = _repo.GetResult().Result;
}
Run Code Online (Sandbox Code Playgroud) 我是 CI 新手。我定义了一个构建。当我对构建进行排队时,出现以下错误:
2018-10-08T09:54:50.0136696Z ##[command]git config --get-all http.https://testurl.extraheader
2018-10-08T09:54:50.1425808Z ##[command]git config --get-all http.proxy
2018-10-08T09:54:50.2763750Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" fetch --tags --prune --progress --no-recurse-submodules origin
2018-10-08T09:54:51.1465256Z fatal: unable to access 'https://testdomain/tfs/Project/_git/Project.Test/': SSL certificate problem: unable to get local issuer certificate
2018-10-08T09:54:51.1719172Z ##[error]Git fetch failed with exit code: 128
Run Code Online (Sandbox Code Playgroud) 我试图打开文件以使用WinSCP .NET程序集从SFTP读取,这与将文件从SFTP存档到Azure blob的练习相当。
要将blob上传到Azure,我正在使用
using (var fileStream = inputStream)
{
blockBlob.UploadFromStream(fileStream);
blobUri = blockBlob.Uri.ToString();
}
Run Code Online (Sandbox Code Playgroud)
如何从SFTP服务器上的文件获取流?
我设法使用SftpClient下面的代码来获取流,并且可以工作,但是不幸的是,使用WinSCP .NET程序集无法实现相同的目的。
sftpClient.OpenRead(file.FullName)
Run Code Online (Sandbox Code Playgroud)
谁能帮我使用WinSCP .NET程序集实现相同的目的?
因为我需要使用用户名,密码和私钥连接到SFTP,所以我使用的是WinSCP .NET程序集。
谢谢
我使用以下映射将我的数据对象映射到viewmodel对象.
ObjectMapper.cs
public static class ObjectMapper
{
public static void Configure()
{
Mapper.CreateMap<User, UserViewModel>()
.ForMember(dest => dest.Title,
opt => opt.ResolveUsing<TitleValueResolver>())
.ForMember(dest => dest.Name,
opt => opt.ResolveUsing<NameValueResolver >())
.ForMember(dest => dest.ShortName,
opt => opt.ResolveUsing<ShortNameValueResolver >());
}
}
Run Code Online (Sandbox Code Playgroud)
分析器
public class Parser{
public string GetTitle(string title){
/* add some logic */
return title;
}
public string GetName(string title){
/* add some logic */
return name;
}
public string GetShortName(string title){
/* add some logic */
return shortname;
}
}
Run Code Online (Sandbox Code Playgroud)
AutoMapperCustomResolvers.cs
public class …Run Code Online (Sandbox Code Playgroud) 我正在使用PrimeNG数据表供我使用。下面是我的代码:
<p-dataTable [value]="alerts" [expandableRows]="true" [expandedRows]="expandedItems" #dt>
<p-column expander="true"></p-column>
</p-dataTable>
Run Code Online (Sandbox Code Playgroud)
如何更改行扩展器的默认图标?
我正在使用EF core 2.0和.Net core2.0来开发我的webapi应用程序.
在下面的查询中,当案例没有工作流程(即可为空的工作流程)时,我会遇到异常.我得到的错误是'System.NullReferenceException:对象引用未设置为对象的实例.'
我怀疑当c.workflow为null时,异常是在.ThenInclude()上.
案例实体:
public class Case
{
[Key]
public int CaseId { get; set; }
public int? WorkflowId { get; set; }
public Workflow Workflow { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
查询:
var item = await _context.Cases
.Include(c => c.CaseDetail)
.Include(c => c.Workflow).ThenInclude(wf => wf.CurrentWorkflowLevel)
.Include(c => c.Alerts)
.FirstOrDefaultAsync(c => c.CaseId == id);
Run Code Online (Sandbox Code Playgroud)
考虑到工作流程是空的,任何人都可以帮助如何实现此查询?
例外:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler.IncludeLoadTreeNodeBase.<_AwaitMany>d__8.MoveNext()
--- End of stack trace from previous location where …Run Code Online (Sandbox Code Playgroud) 我在我的角度应用程序中使用 Primeng Tabview。我有如下所示的代码来使用代码设置活动选项卡。
<button (click)="change(0)">First</button>
<button (click)="change(1)">Second</button>
<button (click)="change(2)">Third</button>
<p:tabView [activeIndex]="index" ...
public index: number;
change(index: number): void {
this.index = index;
}
Run Code Online (Sandbox Code Playgroud)
但是一旦我手动转到选项卡并尝试单击按钮,它就不会转到正确的选项卡。不确定出了什么问题或如何使其工作?
我是角材料的新手。从 angular material doc 我可以看到它可以定位在“开始”或“结束”。
<div style="border:solid 1px red;">
<mat-sidenav-container>
<mat-sidenav class="sidenav"
position="end" <!-- want to position top or bottom here-->
[opened]="sidenavOption.open"
[mode]="sidenavOption.mode">
Sidenav content
</mat-sidenav>
<ng-content></ng-content>
</mat-sidenav-container>
</div>
Run Code Online (Sandbox Code Playgroud)
我想定位“顶部”或“底部”
任何人都可以帮助我如何做到这一点?
谢谢
我是 azure 函数和 Kafka 的新手。
我想知道是否可以在Kafka主题中有消息时触发azure功能?
谢谢
这是我的代码
<div fxLayout="row"
fxLayoutAlign="end center">
Run Code Online (Sandbox Code Playgroud)
我想给fxLayoutAlign添加一个条件。我不知道该怎么做。有人可以帮忙吗?
我尝试了以下方法:
<div fxLayout="row"
fxLayoutAlign="isCondition? 'start center' : 'end center'">
Run Code Online (Sandbox Code Playgroud)
但没有任何作用
谢谢
c# ×5
angular ×2
angular6 ×2
apache-kafka ×1
automapper ×1
css ×1
primeng ×1
quartz.net ×1
tfsbuild ×1
winscp ×1
winscp-net ×1