小编Elm*_*ega的帖子

嵌套tph继承成员的ef-core load collection属性

给出以下类结构

 public class Parent 
    {
        public Guid Id { get; 
        public List<BaseChild> Children { get; set; }
    }

 public abstract class BaseChild
    {
        public int Id { get; set; }
        public string ChildName { get; set; }
    }

public class NormalChild : BaseChild
    {
         public DateTime BirthDate { get; set; }
    }

public class RichChild : BaseChild
    {
        public List<OffshoreAccount> OffshoreAccounts { get; set; }
    }

public class OffshoreAccount 
    {
        public string AccountNumber { get; set; }
        public AccountInfo AccountInfo …
Run Code Online (Sandbox Code Playgroud)

c# linq entity-framework tph entity-framework-core

10
推荐指数
2
解决办法
4094
查看次数

使用 $http.delete 从 angular 发布到 aspnetcore api 时出现不受支持的媒体类型错误

发布到 aspnetcore api 时,我收到 415 http 错误结果。如果我的端点标记为 [HttpPost] 而不是 [HttpDelete],则不会发生这种情况

在 aspnetcore api 控制器中:

[HttpDelete]
public async Task<IActionResult> Delete([FromBody]EntityViewModel vm)
{
Run Code Online (Sandbox Code Playgroud)

在角度控制器中:

 var obj = new Object();
 obj.atr1 = 1;
 obj.atr2 = 2 ;

 $http.post(route, obj)
    .then(function (response) {
Run Code Online (Sandbox Code Playgroud)

实体视图模型.cs

public class EntityViewModel
    {
        public int Atr1 { get; set; }
        public int Atr2 { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

angularjs asp.net-core

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