我们正在使用PrimeNG 1.0.0-beta.16的p-dataTable
我想在值为true时向行添加样式.我想出了如何用单元格做这个,但我需要整行改变它的背景.
<p-dataTable [hidden]="loading" [value]="timePeriods" scrollable="true" scrollHeight="400px" rowStyleClass="missingPeriod">
<p-column field="StartDate" header="Begindatum" sortable="false">
<template let-col let-timePeriod="rowData" pTemplate type="body">
<span [class.missingPeriod]="!timePeriod.IsNext">{{timePeriod.StartDate | date: 'dd-MM yyyy'}}</span>
</template>
</p-column>
<p-column field="EndDate" header="Einddatum" sortable="false">
<template let-col let-timePeriod="rowData" pTemplate type="body">
<span>{{timePeriod.EndDate | date: 'dd-MM yyyy'}}</span>
</template>
</p-column>
</p-dataTable>
Run Code Online (Sandbox Code Playgroud)
<span [class.missingPeriod]="!timePeriod.IsNext">
工作但rowStyleClass="missingPeriod"
不是.
请指教.
更新语法:
已更新至v1.0.1
<p-dataTable [hidden]="loading" [rowStyleClass]="customRowClass" [value]="timePeriods" scrollable="true" scrollHeight="400px">
<p-column field="StartDate" header="Begindatum" sortable="false">
<template let-col let-timePeriod="rowData" pTemplate type="body">
<span [class.missingPeriod]="!timePeriod.IsNext">{{timePeriod.StartDate | date: 'dd-MM yyyy'}}</span>
</template>
</p-column>
<p-column field="EndDate" header="Einddatum" sortable="false">
<template …
Run Code Online (Sandbox Code Playgroud) 我目前正在将我 6 岁的 C# 应用程序转换为 .NET Core v3 和 EF Core(并且还使用 Blazor)。除了分片部分外,大部分都在工作。
我们的应用程序为每个客户端创建一个新数据库。我们或多或少地使用此代码:https : //docs.microsoft.com/en-us/azure/sql-database/sql-database-elastic-scale-use-entity-framework-applications-visual-studio
I '现在正在尝试将其转换为 EF Core,但在这部分卡住了:
// C'tor to deploy schema and migrations to a new shard
protected internal TenantContext(string connectionString)
: base(SetInitializerForConnection(connectionString))
{
}
// Only static methods are allowed in calls into base class c'tors
private static string SetInitializerForConnection(string connnectionString)
{
// We want existence checks so that the schema can get deployed
Database.SetInitializer<TenantContext<T>>(new CreateDatabaseIfNotExists<TenantContext<T>>());
return connnectionString;
}
// C'tor for data dependent routing. …
Run Code Online (Sandbox Code Playgroud) 使用Angular v2.4.8和PrimeNg v1.1.4
我有一个包含两个组件的页面:
我将Dropzone配置为一次发送5个文件,当完成5个文件时,onDropZoneSendingMultiple
会引发事件.上传所有文件时onDropZoneQueueComplete
.
在两个侦听器中,我想刷新第二个组件中的数据表.这不起作用.我需要刷新页面才能看到新文件.
我的主页HTML:
<div class="row" id="dropzoneContainer">
<dropzone class="dropzone" #dz [config]="dropZoneConfig"
(error)="onDropZoneUploadError($event)"
(sendingmultiple)="onDropZoneSendingMultiple($event)"
(queuecomplete)="onDropZoneQueueComplete($event, dz);"
(maxfilesreached)="onDropZoneMaxfilesReached($event)"
(maxfilesexceeded)="onDropZoneMaxfilesExceeded"></dropzone>
</div>
<div class="row">
<div class="col-md-12">
<FilesList></FilesList>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
该Dropzone
-component显示悬浮窗.该FilesList
说明了DataTable.部分HTML:
<p-dataTable [hidden]="loading" [value]="files" selectionMode="single" (onRowSelect)="details($event)">
Run Code Online (Sandbox Code Playgroud)
在我的主要ts文件中,我有:
@ViewChild(FilesListComponent)
public filesListComponent: FilesListComponent;
private reloadFileList() {
this.filesListComponent.reload();
}
Run Code Online (Sandbox Code Playgroud)
在我的文件列表中我有
public files: File[];
public reload() {
this.getFiles();
}
public getFiles() {
this.fileService.getAll()
.then(
data => {
this.files = data;
});
}
Run Code Online (Sandbox Code Playgroud)
getFiles
在页面加载时也会调用.当我添加console.log()
语句时,我可以看到它 …
我正在尝试在我的 .NET Core v3.1 Blazor 应用程序中上传多个文件,但无法超过 30MB 的限制。
搜索这个我发现在 Asp.Net 核心中增加上传文件大小并尝试了建议,但它不起作用。
所有找到的解决方案都涉及更改 web.config,但我没有那个文件。
此外,我的应用程序在开发期间在 Visual Studio 2019 中运行,但也将作为 WebApp 在 Azure 上运行。
这些是我的设置:
program.cs
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>().ConfigureKestrel((context, options) =>
{
options.Limits.MaxRequestBodySize = null;
});
});
Run Code Online (Sandbox Code Playgroud)
上传控制器.cs
[Authorize]
[DisableRequestSizeLimit]
public class UploadController : BaseApiController
Run Code Online (Sandbox Code Playgroud)
Startup.cs 中的配置服务
services.AddSignalR(e => e.MaximumReceiveMessageSize = 102400000)
.AddAzureSignalR(Configuration["Azure:SignalR:ConnectionString"]);
services.Configure<FormOptions>(options =>
{
options.ValueLengthLimit = int.MaxValue;
options.MultipartBodyLengthLimit = long.MaxValue; // <-- !!! long.MaxValue
options.MultipartBoundaryLengthLimit = int.MaxValue;
options.MultipartHeadersCountLimit = int.MaxValue; …
Run Code Online (Sandbox Code Playgroud) c# file-upload iis-express kestrel-http-server asp.net-core-3.1
我有一个非常基本的问题,我无法自己回答,因为大多数指向http://www.primefaces.org/primeng的链接都不再适用.我也尝试注册他们的论坛,但他们的激活邮件永远不会到来.
我使用Angular2并拥有一个包含两列的数据表:filename和status.我想要更改的状态列.它现在拥有1到4的数字,我想根据状态显示一个glyphicon.
我现在有这个,这是有效的:
<p-dataTable [hidden]="loading" [value]="files" selectionMode="single" sortField="Status" [sortOrder]="-1">
<p-column field="FileName" header="Naam" sortable="true"></p-column>
<p-column field="Status" header="Status" sortable="true"></p-column>
</p-dataTable>
Run Code Online (Sandbox Code Playgroud)
我试过这个,只是为了测试模板,但没有任何变化:
<p-dataTable [hidden]="loading" [value]="files" selectionMode="single" sortField="Status" [sortOrder]="-1">
<p-column field="FileName" header="Naam" sortable="true"></p-column>
<p-column field="Status" header="Status" sortable="true">
<template let-file="rowData">
{{file.Status == 1 ? "Yes" : "No"}}
</template>
</p-column>
</p-dataTable>
Run Code Online (Sandbox Code Playgroud)
所以除了得出结论我没有正确使用它.
我们正在使用PrimeNG 1.0.0-beta.16
我有一个 C# 方法,将使用不同的线程多次调用该方法。所以我想创建一个单元测试来在多个线程上测试此方法,但我不确定我做得是否正确。
这是我没有线程的单元测试:
[TestMethod]
public void FromLocalPoints()
{
var projectedCoordinates = this.ConvertFromLocalPoints();
foreach (var projectedCoordinate in projectedCoordinates)
{
Debug.Write(projectedCoordinate.X);
Debug.Write("; ");
Debug.WriteLine(projectedCoordinate.Y);
}
}
Run Code Online (Sandbox Code Playgroud)
this.ConvertFromLocalPoints() 正在调用我想测试的实际方法。
我创建了一个委托、一个事件和一个处理程序:
public delegate void ReprojectCompleteHandler(IEnumerable<Coordinate> projectedCoordinates);
public event ReprojectCompleteHandler ReprojectCompleteEvent;
private void ReprojectHandler(IEnumerable<Coordinate> projectedCoordinates)
{
Debug.WriteLine("Conversion is complete");
}
Run Code Online (Sandbox Code Playgroud)
在我的 TestSetup 中,我监听我的事件:
[TestInitialize]
public void TestSetup()
{
this.ReprojectCompleteEvent += this.ReprojectHandler;
}
Run Code Online (Sandbox Code Playgroud)
我的单元测试是:
[TestMethod]
public void FromLocalPointsThreaded()
{
// Call FromLocalPoints multiple times in separate threads to check if it is thread safe
for …
Run Code Online (Sandbox Code Playgroud) 多年来,我一直在使用工具条容器中的多个工具条.我有一个用VS2008编写的当前.NETv3.5应用程序,其中工具条的位置是随机的.已经制作了许多自定义代码来解决这个问题,但没有任何运气.
目前我在VS2012上使用.NETv4.5应用程序,该应用程序也有多个工具条.我创建了一个非常小的测试应用程序,它是一个带有docked tooltripcontainer和4个工具条的表单.在设计时我在底部添加了3个工具条,在右边添加了1个工具条.
在不添加任何代码并启动此应用程序的情况下,我的工具条位于与设计时相同的位置.现在我重新排序3个顶级工具条并重新启动应用程序.我的重新排序更改未保存,工具条再次与设计时间一样.
现在我添加以下代码行:
public partial class Toolstrips : Form
{
private string keyName;
public Toolstrips()
{
this.InitializeComponent();
this.keyName = Application.ProductName + this.Name + "xyz";
ToolStripManager.LoadSettings(this, this.keyName);
}
private void Toolstrips_FormClosing(object sender, FormClosingEventArgs e)
{
ToolStripManager.SaveSettings(this, this.keyName);
}
}
Run Code Online (Sandbox Code Playgroud)
而且在使用.NETv4.5的VS2102中,这不起作用.我可以在重新启动应用程序后重新排序我想要的所有工具条都恢复到设计时间位置.
我原本希望这可以在VS2012修复,但显然不是.有没有人有办法让这个工作?
编辑:添加内容user.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="System.Windows.Forms.ToolStripSettings.GUI-prototypeToolstripsxyz.toolStripTable" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="System.Windows.Forms.ToolStripSettings.GUI-prototypeToolstripsxyz.toolStripPan" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="System.Windows.Forms.ToolStripSettings.GUI-prototypeToolstripsxyz.toolStripStandard" type="System.Configuration.ClientSettingsSection, System, …
Run Code Online (Sandbox Code Playgroud) 我有一个新的 .NET6 Azure Functions 应用程序。我使用 OpenAPI 规范创建了一些 HTTP 函数。
我的 swagger 页面工作正常,除了 POST 功能。
我想在此页面上显示一个最小的正文请求作为示例。
我已经IOpenApiExample
按照https://github.com/Azure/azure-functions-openapi-extension/blob/main/docs/openapi-core.md#openapirequestbodyattribute
中提到的方式实现了
,但未使用该示例。它不断显示整个模型,没有任何样本值。
这是我的相关代码:
[FunctionName("PostHistoryEvent")]
[OpenApiOperation(operationId: "PostHistoryEvent", tags: new[] { "Post HistoryEvent" })]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiRequestBody("application/json", typeof(HistoryEvent), Required = true, Description = "Description of OpenApiRequestBody", Example = typeof(HistoryEventOpenApiExample))]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.Created, contentType: "application/json", bodyType: typeof(HistoryEvent), Description = "The created History Event")]
public async Task<IActionResult> PostHistoryEvent(...){...}
public class HistoryEventOpenApiExample : OpenApiExample<HistoryEvent>
{
public override IOpenApiExample<HistoryEvent> Build(NamingStrategy namingStrategy = …
Run Code Online (Sandbox Code Playgroud) 我正在使用 MudBlazor v6.07,并且我知道如何使用新主题和代码来更改 (UI) 组件的单独颜色,如下所示:
private MudTheme _myTheme= new MudTheme();
_myTheme.Palette.Primary = new MudBlazor.Utilities.MudColor("#090");
Run Code Online (Sandbox Code Playgroud)
但我想立即切换到其中一种调色板,例如绿色或粉色。而不是一一修改每个主题颜色。
我认为这是可以做到的,但我找不到如何做到这一点。
我们正在尝试将 EF6 + CodeFirst 与 PostGIS 数据库一起使用。
PostgreSQL v9.3.10
PostGIS v2.1.3
npgsql v3.2.2.0
EntityFramework6.Npgsql v3.1.1.0
Run Code Online (Sandbox Code Playgroud)
我没有几何图形的简单模型可以正常工作,Add-Migrations
但是当我添加DbGeometry
属性时Add-Migrations
失败
Not supported edm type: Edm.Geometry
at Npgsql.NpgsqlProviderManifest.GetStoreType(TypeUsage edmType)
at System.Data.Entity.ModelConfiguration.Edm.Services.StructuralTypeMappingGenerator.MapTableColumn(EdmProperty property, String columnName, Boolean isInstancePropertyOnDerivedType)
Run Code Online (Sandbox Code Playgroud)
谷歌搜索我在 npgsql 的 GitHub 上找到了这些帖子:https : //github.com/npgsql/npgsql/issues/623和 https://github.com/npgsql/EntityFramework6.Npgsql/issues/18
这些帖子是 2015 年 5 月的。我无法想象还没有人找到解决这个问题的方法。我们不能成为多年来第一个EF6+CodeFirst
与PostGIS
.
因此,请建议如何继续或建议其他正在运行的提供商。
postgis npgsql entity-framework-6 entity-framework-migrations
c# ×4
angular ×3
primeng ×3
datatable ×2
entity-framework-migrations ×1
file-upload ×1
iis-express ×1
mudblazor ×1
npgsql ×1
openapi ×1
postgis ×1
sharding ×1
swagger-ui ×1
themes ×1
toolstrip ×1
unit-testing ×1