小编Lie*_*ero的帖子

推送到 FormArray 不会更新 mat-table

我有一个带有 FormArray 的 FormGroup 和一个显示数组的 mat-table。当我向 FormArray 添加新的 FormGroup 时,mat-table 不会添加新行。

我试图给 trackBy 做广告,但我不知道在哪里(老实说,也不知道为什么)。

组件.html:

<form [formGroup]="formGroup">
    <div formArrayName="items">
        <button mat-raised-button (click)="addNew()">New Case</button>

        <table mat-table [dataSource]="items.controls">
            <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
            <mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>

            <ng-container matColumnDef="itemKey">
                <mat-header-cell *matHeaderCellDef> Key </mat-header-cell>
                <mat-cell *matCellDef="let item; let i = index" [formGroupName]="i">
                    <mat-form-field> 
                        <input formControlName="itemKey" matInput />
                    </mat-form-field>
                </mat-cell>
            </ng-container>
Run Code Online (Sandbox Code Playgroud)

和 component.ts:

formGroup = new FormGroup({
   items: new FormArray()
});

get items() { return this.formGroup.get("items") as FormArray }


addNew() {
  this.items.push(new FormGroup({
    itemKey: new FormControl(), …
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular angular-forms angular7

4
推荐指数
1
解决办法
2151
查看次数

本地环境中的 U-SQL

我刚刚在 msdn 杂志上阅读了有关 U-SQL 的精彩文章。

U-SQL 是在 microsoft azure 中分析大数据的好工具。

但是,是否可以在非云环境中使用它,例如在本地托管的 SQL Server 中?

azure bigdata u-sql

3
推荐指数
1
解决办法
333
查看次数

Scaffold-DbContext 和 dotnet-ef-dbcontext-scaffold 的区别

我看到有一些方法可以在 Entity Framework Core 2.0 中构建实体和数据库上下文。

  1. 使用 Scaffold-DbContext
  2. 使用 dotnet ef dbcontext scaffold

为什么有两种工具,有什么区别?

entity-framework entity-framework-core db-first

3
推荐指数
1
解决办法
538
查看次数

xhr.withCredentials = true; 不适用于 Chrome

我在 Chrome 中验证 CORS 请求时遇到问题。

我在 localhost 上运行单页应用程序,在 Azure 中运行 Web 服务。我使用 OpenIdConnect 登录。

当我像这样在 EDGE 中向后端发出 CORS 请求时,身份验证有效:

$.ajax({
   type: 'get',
   url: buildBackendUrl("api/Account"),
   xhrFields: { withCredentials: true }
});
Run Code Online (Sandbox Code Playgroud)

但同样的方法在 Chrome 中不起作用。当我手动在浏览器中输入 Web 服务 url 时,请求已通过身份验证。

我检查了 CORS 请求的请求标头,差异在于 cookie:

  • 边缘: ARRAfinity=...; AspNetCore.Cookies=...
  • 铬合金:ARRAfinity=...

为什么 Chrome 不包含所有 cookie?

编辑:这里是提琴手捕获的请求:

  1. 当我按登录时重定向:
    myapp.azurewebsites.net/api/Account/login?returnUrl=http://localhost:46563/
  2. 由于我已经登录,因此无需转到登录页面。重定向
    myapp.azurewebsites.net/signin-oidc
  3. 重定向回来:localhost:46563/
  4. 由 Localhost 制作的 CORS: myapp-dev.azurewebsites.net/api/Account

在请求 nr3 或 4 中,我都没有看到 cookie。

无论如何,请求 nr2 ( myapp.azurewebsites.net/signin-oidc) 的响应尝试设置 cookie:

HTTP/1.1 302 Found
Cache-Control: no-cache …
Run Code Online (Sandbox Code Playgroud)

javascript authentication cookies google-chrome cross-domain

3
推荐指数
1
解决办法
6567
查看次数

为什么 asp.net 核心应用程序在连接到 SQL Server 时使用与 AppPool 身份不同的用户进行 Windows 身份验证?

我已将 asp.net core 2.2 web 应用程序作为网站部署到 IIS。我已将应用程序池标识设置为 ApplicationPoolIdentity:

[IIS 屏幕截图[1]

我可以看到System.Security.Principal.WindowsIdentity.GetCurrent()返回

IIS APPPOOL\MyCustomAppPool
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用连接字符串连接到 SQL Server 时:

Server=localhost;Database=MyDadatabse;Trusted_Connection=True;
Run Code Online (Sandbox Code Playgroud)

我收到以下错误(忽略德语):

SqlException: Fehler bei der Anmeldung für den Benutzer "CompanyDomain\ComputerName$"。

为什么不使用 ApplicationPool 标识?

另请注意,当我将自定义用户名/密码设置为应用程序池的身份时,它会起作用。

sql-server iis windows-authentication asp.net-core

3
推荐指数
1
解决办法
2710
查看次数

如何修改 csproj PublishRunWebpack 以包含外部目录中的静态文件

我从 ASP.NET Core Web 应用程序 -> Angular SPA 开始,但我已将 Angular 应用程序移至 csproj 外部的单独存储库。

所以我的文件夹结构如下所示:

frontend
  dist

backend
  wwwroot
  backend.csproj
Run Code Online (Sandbox Code Playgroud)

现在我想修改 csproj 以便发布复制frontend/dist/**/*.*$(outputDirecory)/ClientApp/dist/**/*.*

我应该如何修改 PublishRunWebpack 目标来复制这些文件:

  <PropertyGroup>
    <SpaRoot>../Frontend</SpaRoot>
  </PropertyGroup>
  
  <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
    <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
    <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />

    <!-- Include the newly-built …
Run Code Online (Sandbox Code Playgroud)

iis webdeploy asp.net-core angular asp-net-core-spa-services

3
推荐指数
1
解决办法
5769
查看次数

如何在 Blazor 中动态生成 CSS 规则

换句话说,我需要生成 css 类并将它们以某种方式注入到页面中。

我需要在 C# 运行时修改类。

为什么?假设我的剃刀组件呈现数千个元素,并且我需要更改所有这些元素的宽度。我不想修改许多元素上的样式属性,而是只想修改单个 css 规则。

JS 互操作是可以接受的。

javascript css blazor

3
推荐指数
1
解决办法
7660
查看次数

如何在UWP Composition API中组合多个效果

我想结合模糊,饱和度和色调.

我有一个混合效果,由GaussianBlur和Tint颜色组成.

_compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

var graphicsEffect = new BlendEffect
{
    Mode = BlendEffectMode.Overlay,
    Background = new GaussianBlurEffect()
    {
        Name = "Blur",
        Source = new CompositionEffectSourceParameter("Backdrop"),
        BlurAmount = 10f
        BorderMode = EffectBorderMode.Hard,
    },
    Foreground = new ColorSourceEffect()
    {
        Name = "Tint",
        Color = Color.FromArgb(120, 255, 255, 255),
    }
};


var effectFactory = _compositor.CreateEffectFactory(graphicsEffect)
_brush = effectFactory.CreateBrush();
_brush.SetSourceParameter("Backdrop", _compositor.CreateBackdropBrush());

_effectSprite = _compositor.CreateSpriteVisual();
_effectSprite.Size = new Vector2((float)this.ActualWidth, (float)this.ActualHeight)
_effectSprite.Brush = _brush;
ElementCompositionPreview.SetElementChildVisual(this, _effectSprite)
Run Code Online (Sandbox Code Playgroud)

如何在此效果之前或之后添加SaturationEffect?

我试图将它包装到另一个BlendEffect中并将另一个BackdropBrush设置为SaturationEffect的源,但我只有白色背景.

我也尝试从SaturationEffect创建画笔并将其设置为GaussianBlur的源代码,但我得到异常"Invalid Source Brush"

c# uwp windows-composition-api

2
推荐指数
1
解决办法
333
查看次数

使用 DeveloperExceptionPage 时如何使用 ApplicationInsights 2.x 记录 ASP.NET Core 应用程序中的异常

是否有有关 ApplicationInsights 2.x 和 asp.net core 的任何文档?

我发现了这个: https: //learn.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-exceptions,但看起来已经过时了。

它使用“HandleErrorAttribute”,但它是.NET Framework 的类,而不是.net core。

.net azure azure-application-insights asp.net-core

2
推荐指数
1
解决办法
1427
查看次数

Angular TinyMCE 图标消失了

我有一个带有tinymce编辑器的Angular 8项目。它在本地工作,但在某些时候工具栏图标在使用 CI/CD 管道部署的生产中消失了。

屏幕截图

我得到 404 /tinymce/icons/default/icons.min.js

icon.min.js 到底是什么?

我的 angular.json 资产如下所示:

{
                "glob": "**/*",
                "input": "node_modules/tinymce/skins",
                "output": "/tinymce/skins/"
              },
              {
                "glob": "**/*",
                "input": "node_modules/tinymce/themes",
                "output": "/tinymce/themes/"
              },
              {
                "glob": "**/*",
                "input": "node_modules/tinymce/plugins",
                "output": "/tinymce/plugins/"
              }
Run Code Online (Sandbox Code Playgroud)

tinymce angular angular8

2
推荐指数
1
解决办法
1132
查看次数