I would like to know how to setup a ODataV4 Adaptor where the PrimaryKey is generated by the backend server (Asp.net Core 2.2) upon adding and saving a record to the Grid. How can I achieve this ? At the moment the asp.net OdataController is alway receiving a null User object when the UUID is not initialized on the Client end (angular).
public User
{
[Key]
public Guid UUID {get;set;} // PrimaryKey
public string Name {get;set;}
public DateTime DoB {get;set;}
}
[ODataRoutePrefix("Users")]
public class UsersController : ODataController
{
private readonly IDatabase _db;
public UsersController(IDatabase db)
{
_db = db;
}
// ......
[HttpPost]
[ODataRoute()]
public IActionResult Post([FromBody] User user)
{
// Issue where user class is always null if the UUID property is not initialized on the client end (angular)
// How do I achieve creation of the UUID on the server end
_db.AddUser(user);
return Created(user);
}
}