我有以下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) 当我尝试从 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)