Issue
Scenario:
- SignalR version 1.0.0 RC1 Final
- DotNet Core 2.0
- Tipical: User - Posts - Comments models.
Issue:
When I send a model through websocket fails silently (no message is send to clients). It works fine if I set to null navigation property:
_context.Posts.Add(model);
_context.SaveChanges();
model.User.Posts = null; // <- removing this line fails silently
_hub.Clients.All.SendAsync("AddAsync", model);
How can I diagnose what is happens? Someone knows what is the reason?
Some unnecesary code details
User.cs
public Guid Id { get; set; }
// ...
public virtual List<Post> Posts { get; set; } = new List<Post>();
Post.cs
public Guid Id { get; set; }
// ...
public virtual User User { get; set; }
PostsController.cs
private IHubContext<PostsHub> _hub;
private DatabaseContext _context;
public PostsController(IHubContext<PostsHub> hub)
{
_hub = hub;
}
// ...
[HttpPost]
public async Task<ActionResult> PostAsync([FromBody] Post model)
{
// ...
_context.Posts.Add(model);
_context.SaveChanges();
model.User.Posts = null;
_hub.Clients.All.SendAsync("AddAsync", model);
// ...
}
How can I diagnose what is happens? Someone knows what is the reason?Any case, thanks and good shot. - dani herrera