我想使用RavenDb 4.0.0-beta-40018查询包含动态属性的实体,但我不确定如何操作.
class Foo {
public int Id { get; set; }
public DateTime CreatedAt { get; set; }
public string Name { get; set; }
public dynamic Attributes { get; set; }
}
{
"Attributes": {
"IsFeatured": true
},
"CreatedAt": "2017-08-30T15:53:21.1881668Z",
"Name": "Featured Foo"
}
Run Code Online (Sandbox Code Playgroud)
这是我试图使用的查询.
const string propertyName = "IsFeatured";
var results = session.Query<Foo>()
.Where(x => x.Attributes != null)
.Where(x => x.Attributes[propertyName] != null)
.Where(x => x.Attributes[propertyName] == true);
Run Code Online (Sandbox Code Playgroud)
遗憾的是,我甚至无法编译此代码,因为我收到编译错误(Error: An expression tree may not contain a …
正如您在下面的图片中看到的那样,它对我不起作用.模板html出现在表格上方,而不是我预期的标题下方.
我要做的是创建一个可用于表数据的可选过滤器组件.添加组件时,它应在标题列下方显示一个额外的行,其中包含输入/按钮,允许您将过滤器放在特定列上.
所以显然我做错了什么,或者做了一些我不应该做的事情.如果是这样,我该如何正确地注入filter-table
组件的模板?
我的app.html
.
<table class="table table-bordered table-striped">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>City</th>
<th>Username</th>
<th>Email</th>
<th>Nationality</th>
</tr>
<table-filter containerless></table-filter>
</thead>
<tbody>
<tr>
<td>??</td>
<td>Name</td>
<td>City</td>
<td>Username</td>
<td>Email</td>
<td>Nationality</td>
</tr>
</tbody>
<table>
Run Code Online (Sandbox Code Playgroud)
我的table-filter
组件.
// Viewmodel
@customElement('table-filter')
export class TableFilterComponent {
// Nothing here
}
// Template
<template>
<tr>
<th>Filter header 1</th>
<th>Filter header 2</th>
<th>Filter header 3</th>
<th>Filter header 4</th>
<th>Filter header 5</th>
<th>Filter header 6</th>
</tr>
</template>
Run Code Online (Sandbox Code Playgroud) 我试图通过运行以下命令在我的Windows Server(2012 R2)上运行dotnet核心api(2.1.0):dotnet Api.dll
但我不断收到以下消息.
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet\
- Installing .NET Core prerequisites might help resolve this problem:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
Run Code Online (Sandbox Code Playgroud)
当我使用相同的命令(dotnet Api.dll
)时,api在我的mac上正常运行.当我使用时,dotnet --info
我得到以下内容,并说它安装了最新的Runtime和SDK.
Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.300\
Host (useful for support):
Version: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试运行我的sphinx服务器的索引器.
这是我使用的命令(通过root访问)来启动索引:
indexer --all
当我使用命令时,这是我得到的反应:
Sphinx 2.1.9-id64-release (rel21-r4761)
Copyright (c) 2001-2014, Andrew Aksyonoff
Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/etc/sphinxsearch/sphinx.conf'...
FATAL: no indexes found in config file '/etc/sphinxsearch/sphinx.conf'
Run Code Online (Sandbox Code Playgroud)
这是位于的sphinx.conf文件 /etc/sphinxsearch/
#############################################################################
## indexer settings
#############################################################################
indexer
{
# memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
# optional, default is 32M, max is 2047M, recommended is 256M to 1024M
mem_limit = 1024M
}
#############################################################################
## searchd settings
#############################################################################
searchd
{
listen = 127.0.0.1:9312
listen = …
Run Code Online (Sandbox Code Playgroud) 我试图从dotnet核心web api操作下载一个zip文件,但我无法使其工作.我尝试通过POSTMAN和我的Aurelia Http Fetch Client调用该操作.
我能够像我想要的那样创建ZipFile并将其存储在系统上,但无法修复它,因此它通过api返回zip文件.
用例:用户选择几个图片集并单击下载按钮.图片集的ID被发送到api并创建一个zipfile,其中包含用于保存图片的每个图片集的目录.该zipfile返回给用户,以便他/她可以将其存储在他们的系统上.
任何帮助,将不胜感激.
我的控制器动作
/// <summary>
/// Downloads a collection of picture collections and their pictures
/// </summary>
/// <param name="ids">The ids of the collections to download</param>
/// <returns></returns>
[HttpPost("download")]
[ProducesResponseType(typeof(void), (int) HttpStatusCode.OK)]
public async Task<IActionResult> Download([FromBody] IEnumerable<int> ids)
{
// Create new zipfile
var zipFile = $"{_ApiSettings.Pictures.AbsolutePath}/collections_download_{Guid.NewGuid().ToString("N").Substring(0,5)}.zip";
using (var repo = new PictureCollectionsRepository())
using (var picturesRepo = new PicturesRepository())
using (var archive = ZipFile.Open(zipFile, ZipArchiveMode.Create))
{
foreach (var id in ids)
{
// Fetch …
Run Code Online (Sandbox Code Playgroud) download zipfile asp.net-web-api .net-core aurelia-fetch-client
我有一个 dotnet 核心 api,它返回一个 FileContentResult ..
return new FileContentResult(bytes, contentType)
{
FileDownloadName = Path.GetFileName(request.Filename)
};
Run Code Online (Sandbox Code Playgroud)
通过邮递员,我可以完美地读出图像。现在我想通过 aurelia fetch 客户端读取图像,并将其显示在我的 html 视图中。这是我从api检索图像的功能。
public image(filename: string) {
return this.http.fetch(AppConfiguration.base_url + 'assets/image',
{
method: 'post',
body: json({
filename: filename
})
});
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用此值转换器转换响应中的 blob。但我不能让它工作
转换器:
export class BlobToUrlValueConverter {
public toView(blob) {
return URL.createObjectURL(blob);
}
}
Run Code Online (Sandbox Code Playgroud)
视图模型:
export class Dashboard {
public blob: any;
constructor(
public assets_service: AssetsService
) { }
async attached() {
let response = await this.assets_service.image('test.png');
this.blob = response.blob();
} …
Run Code Online (Sandbox Code Playgroud)