我想创建一个图像处理程序,但我在使用Web API 2或只是正常之间撕裂Generic Handler (ashx)
我过去已经实现过,但哪一个是最正确的.我找到了一个旧的SO帖子LINK,但它仍然真的相关吗?
我正在使用 TFS Online 进行持续集成 构建通过但发布失败,因为我收到以下错误
Unhandled: Failed rmRF: EPERM: operation not permitted, unlink 'C:\path\.bowerrc'
Run Code Online (Sandbox Code Playgroud)
我注意到的事情是,当我查看 TFS 中的文件时,我可以看到 .bowerrc,但是一旦构建后工件被丢弃,并且我查看 Zip 文件,.bowerrc 就不是他们的,这可能是原因
尝试对某些字段的列表进行排序.firstName和lastName,但我已经注意到了一些变化无常的结果.
我正在运行一个简单的查询
//Return all the employees from a specific company ordering by lastName asc | desc
GET employee-index-sorting
{
"query": {
"bool": {
"filter": {
"term": {
"companyId": 3179
}
}
}
},
"sort": [
{
"lastName.keyword": { <-- Should this be keyword? or not_analyzed
"order": "desc"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
结果为什么van der Mescht和van Breda会出现在Zwane和Zwezwe之前?
我怀疑我的映射有问题
{
"_index": "employee-index",
"_type": "_doc",
"_id": "637467",
"_score": null,
"_source": {
"companyId": …Run Code Online (Sandbox Code Playgroud) 在 Autofac 中,您可以使用 RegisterAssemblyTypes 注册您的依赖项,这样您就可以执行这样的操作,有没有办法在构建中执行类似DI的操作.net Core
builder.RegisterAssemblyTypes(Assembly.Load("SomeProject.Data"))
.Where(t => t.Name.EndsWith("Repository"))
.AsImplementedInterfaces()
.InstancePerLifetimeScope();
Run Code Online (Sandbox Code Playgroud)
这就是我要注册的内容
LeadService.cs
public class LeadService : ILeadService
{
private readonly ILeadTransDetailRepository _leadTransDetailRepository;
public LeadService(ILeadTransDetailRepository leadTransDetailRepository)
{
_leadTransDetailRepository = leadTransDetailRepository;
}
}
Run Code Online (Sandbox Code Playgroud)
LeadTransDetailRepository.cs
public class LeadTransDetailRepository : RepositoryBase<LeadTransDetail>,
ILeadTransDetailRepository
{
public LeadTransDetailRepository(IDatabaseFactory databaseFactory)
: base(databaseFactory) { }
}
public interface ILeadTransDetailRepository : IRepository<LeadTransDetail> { }
Run Code Online (Sandbox Code Playgroud)
这就是我当时尝试注册的方式,但我无法弄清楚如何注册存储库 Startup.cs
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
services.AddTransient<ILeadService, LeadService>();
//not sure how to register the repositories …Run Code Online (Sandbox Code Playgroud) 我正在使用JsonPatchDocument更新我的实体,如果JSON看起来如下,这很好用
[
{ "op": "replace", "path": "/leadStatus", "value": "2" },
]
Run Code Online (Sandbox Code Playgroud)
当我创建对象时,它会将其转换为Operations节点
var patchDoc = new JsonPatchDocument<LeadTransDetail>();
patchDoc.Replace("leadStatus", statusId);
{
"Operations": [
{
"value": 2,
"path": "/leadStatus",
"op": "replace",
"from": "string"
}
]
}
Run Code Online (Sandbox Code Playgroud)
如果JSON对象看起来像Patch不起作用.我相信我需要使用它来转换它
public static void ConfigureApis(HttpConfiguration config)
{
config.Formatters.Add(new JsonPatchFormatter());
}
Run Code Online (Sandbox Code Playgroud)
这应该解决,问题是我使用.net核心所以不是100%确定在哪里添加 JsonPatchFormatter
是否可能有一个包含多个工件的发布管道,这些工件会有条件地触发各个阶段。
例:
(Build Artifact 1) 构建标签 Web
(Build Artifact 2) 构建标签 Identity
当我设置发布管道时,我创建了一个管道并添加了
(Build Artifact 1) -> Web Stage
(Build Artifact 2) -> Identity Stage
设置了这两个工件后,会自动触发释放并设置为 After Release
我的问题是,当我(Build Artifact 2)将两个阶段的构建都排队时,将会部署。我只想Identity Stage部署,反之亦然。
我希望所有内容都在一个管道中的原因是因为我的所有工件都包含在一个管道中,我知道如果我创建单独的管道可以做到这一点。
我正在尝试设置Continuations Integration一个旧项目。
该项目仍然使用网站而不是网络应用程序。在Visual studio我创建了发布配置文件。我只想将它发布到解决方案中的本地文件夹。
当我从内部发布时它工作得很好,Visual studio但是一旦我运行MSbuild命令,它就会创建一个PrecompiledWeb文件夹并将代码放在那里。
这会导致我的构建工件在我尝试设置时立即失败 CI
这是我的发布配置文件设置
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>.\Publish</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>False</PrecompileBeforePublish>
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我什至试图将 设置PrecompileBeforePublish为 false。但这也不起作用。
我的MSBuild命令
c:\development\projectname>msbuild project.sln /p:deployOnBuild=true /p:publishProfile=projectFileSystem
Run Code Online (Sandbox Code Playgroud) 鉴于我有一个像这样的简单对象
public class TestA
{
public int TestAId { get; set; }
public string Description { get; set; }
public IEnumerable<TestB> TestBCollection { get; set; }
}
public class TestB
{
public int TestBId { get; set; }
public int FkTestAId { get; set; }
public string Description { get; set; }
}
List<TestA> a = new List<TestA>()
{
new TestA()
{
TestAId = 1,
Description = "Test A Description",
TestBCollection = new List<TestB>()
{
new TestB()
{
TestBId = …Run Code Online (Sandbox Code Playgroud) 我.netcore1.1昨天将我的项目升级到了2,迁移工作进展顺利,但意识到Intellisense我的控制器已经破坏,引用了其他类库,如Services或Models.引用其他类库的类库工作正常,似乎只有在您引用Web项目时才会这样.
然后我创建了一个新的dotnetcore 2应用程序,添加了2个类库,并在web项目中引用它,它做了同样的事情.
这是我的Visual Studio的错误还是错误的?我正在运行VS 2017版本15.3.2(最新)
更新 我将我的类库从.Net Standard 2.0更改为.Net Standard 1.6然后它再次开始工作但我不能使用它,因为我需要2.0
请找到问题链接的附加小提琴
我想做的是将对象转换为字典该对象看起来像这样
var person = new Person
{
FirstName = "Jon",
LastName = "Doe",
Address = new Address
{
Street = "Melkbos",
PostalCode = 90210
}
};
Run Code Online (Sandbox Code Playgroud)
所需的输出应该如下所示
{
{"FirstName", "Jon"},
{"LastName", "Doe"},
{"Address.Street", "Melkbos"},
{"Address.PostalCode", 90210},
};
Run Code Online (Sandbox Code Playgroud)
因此,如果对象是嵌套的,我想要一个点符号
c# ×4
asp.net-core ×2
tfs ×2
asp.net ×1
azure-devops ×1
azure-pipelines-release-pipeline ×1
bower ×1
dictionary ×1
dsl ×1
json-patch ×1
kibana ×1
lambda ×1
linq ×1
msbuild ×1