小编mai*_*ifs的帖子

在程序集"SMSApp"中找到了多个迁移配置类型.指定要使用的名称

我正在使用代码优先方法开发mvc 5应用程序.

我正面临一个问题.在我第一次尝试下面的命令时,它在该数据库中工作并生成表.但是当我更改了一些类,然后尝试了前2个查询时,它就适用于那种情况但是当我尝试第三个命令时,它给了我这个消息.

First step
==========

enable-migrations -ContextTypeName IdentityDb -MigrationsDirectory DAL\IdentityMigrations

enable-migrations -ContextTypeName SMSContext -MigrationsDirectory DAL\SMSMigrations

Second Step
===========

add-migration -ConfigurationTypeName SMSApp.DAL.IdentityMigrations.Configuration "InitialCreate"

add-migration -ConfigurationTypeName SMSApp.DAL.SMSMigrations.Configuration "InitialCreate"

Third Step
==========

update-database -ConfigurationTypeName SMSApp.DAL.IdentityMigrations.Configuration -verbose

update-database -ConfigurationTypeName SMSApp.DAL.SMSMigrations.Configuration -verbose

看到第一个错误:

PM> add-migration -ConfigurationTypeName SMSApp.DAL.IdentityMigrations.Configuration "InitialCreate"
Scaffolding migration ' '.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next …
Run Code Online (Sandbox Code Playgroud)

.net asp.net-mvc entity-framework ef-code-first

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

如何使 Blazor HTTP Get JSON ASYNC 请求?

我正在尝试在示例应用程序中实现一个小的 crud。

我在应用程序中使用 blazor,但发现服务器调用存在一些问题。

我创建了一个简单的 API 控制器,名称为 Employee,方法为 HTTP 动词。

 [ApiController]
    [Route("[controller]")]
    public class EmployeeController : ControllerBase
    {
        EmployeeRepository objemployee = new EmployeeRepository();   
        [HttpGet]
        [Route("api/Employee/Index")]
        public IEnumerable<Employee> Index()
        {
            return objemployee.GetAllEmployees();
        }
   }  
Run Code Online (Sandbox Code Playgroud)

empList = await Http.GetJsonAsync<Employee[]>("/api/Employee/Index"); 
Run Code Online (Sandbox Code Playgroud)

line 报告了一个问题,我不知道它,因为我是 blazor 的新手。我应该在我的代码中做什么?

用asp构建的应用程序。Net core 3.0”、“blazor preview 9”。

输出:我尝试遵循指南并查找示例实现,但无法解决问题。

我收到以下异常:

  WASM: Unhandled exception rendering component:
d.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM: 
    System.Text.Json.JsonException: 
    '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. ---> 
    System.Text.Json.JsonReaderException: '<' is …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-web-api asp.net-core blazor blazor-webassembly

5
推荐指数
1
解决办法
1万
查看次数

Angular6:Mat-tree-node 选择/点击事件实现

我正在使用带有动态数据的 Angular Material Tree Control。

这是完整示例的链接:

例子在这里

它的工作原理如示例中所述。现在我想启用每个节点单击事件并在我的打字稿函数中发送(角度表达式)绑定数据。

任何人都可以指导我吗?

我尝试了不同的代码,但无法为单击启用树节点。

见html:

    <mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
  <mat-tree-node *matTreeNodeDef="let node" matTreeNodePadding>
    <button mat-icon-button disabled ></button>
    {{node.item}}
  </mat-tree-node>
  <mat-tree-node *matTreeNodeDef="let node; when: hasChild" matTreeNodePadding>
    <button mat-icon-button  (click)="applyFilter($event)"
            [attr.aria-label]="'toggle ' + node.filename" matTreeNodeToggle>
      <mat-icon class="mat-icon-rtl-mirror">
        {{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
      </mat-icon>
    </button>
    {{node.item}}
    <mat-progress-bar *ngIf="node.isLoading"
                      mode="indeterminate"
                      class="example-tree-progress-bar"></mat-progress-bar>
  </mat-tree-node>
</mat-tree>
Run Code Online (Sandbox Code Playgroud)

我试过这个来源,但仍然无法修复它。我尝试了堆栈溢出解决方案,但还无法解决我的问题。

 ngAfterViewChecked() {
    this.treeNodes.forEach((reference) => {
      if (!this.hasListener.includes(reference.nativeElement)) {
        console.log('* tick');

        this.renderer.listen(reference.nativeElement, 'click', () => {
          this.updateHighlight(reference);
        });
        this.renderer.listen(reference.nativeElement.children.item(0), 'click', () => {
          this.updateHighlight(reference);
        });

        this.hasListener …
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular

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

即使在 Angular 7 中使用编译器选项作为目标 es6 和 es2017,如何修复编译时错误?

当我尝试编译我的 Angular 7 源代码时,我遇到了编译错误。

任何人都可以指导我吗?

我试图在谷歌上找到这些错误并使用了一些文章。

请看我的 tsconfig.json

 {
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2017",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [      
      "es2017",
      "dom"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

我什至添加了es6但错误仍然相同。

我更新了以下软件包,但错误仍然相同。

 "@types/node": "^10.12.18",
 "ts-node": "^7.0.1",
 "tslint": "^5.12.0"
Run Code Online (Sandbox Code Playgroud)

我使用的是 Angular 7.1.4 和 Material 7.2.0。

错误如下:

Severity    Code    Description Project File    Line    Suppression State
Error   TS2583  (TS) Cannot find name 'Set'. Do you need to change your target library? …
Run Code Online (Sandbox Code Playgroud)

node.js typescript angular

3
推荐指数
3
解决办法
2万
查看次数