小编abd*_*dru的帖子

如何在角度2材料设计中设置md-select组件的默认值?

我有以下select组件,它来自rest api的数据.如何在md-select上设置默认选择值?

  <md-select
                placeholder= "Warehouse"
                style="width: 100%"
                [(ngModel)]='selectedProductWarehouse.warehouse'
                name="Warehouse"
                required
                #Warehouse="ngModel">
          <md-option *ngFor="let warehouse of warehouses" [value]="warehouse">{{warehouse.description}}</md-option>
        </md-select>
Run Code Online (Sandbox Code Playgroud)

material-design angular-material2 angular

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

实体框架核心:Npgsql.PostgresException:23505:重复键值违反唯一约束

当我尝试从 asp.net web api 插入用户时出现以下异常: Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> Npgsql.PostgresException: 23505: duplicate key value violates unique constraint

以下是我的实体模型:角色和用户。其中每个用户都链接到一个角色。

public class Role
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public DateTime DateCreated { get; set; }
    public DateTime? LastUpdate { get; set; }
}

public class User
{
    public int Id { get; set; } …
Run Code Online (Sandbox Code Playgroud)

c# postgresql entity-framework npgsql

6
推荐指数
2
解决办法
8892
查看次数