Getting NotMapped Properties returned in JSON after POST call

Hello,

I can't seem to figure out why I can't get a NotMapped property on a model returned with the JSON after creating a record. I've populated the OnXXXXCreated method and see via debugger that it is set in the "item" variable. I do get the NotMapped property returned for the Read, Get, and Update methods using the same procedure to populate the property. I've also tried putting the NotMapped property in the $expand parameter for the Create request.

Thanks,
Jatin

Hi @jbhakta,

Can you post the code of your CreatesXXX method?

Best Regards,
Vladimir

Hi @enchev,

    partial void OnProductCreated(Models.DbApp.Product item)
    {
        List<Product> listOneItem = new List<Product>() { item };
        item = JoinTables(listOneItem.AsQueryable()).First();
    }

In JoinTables():

        var clients = GetClients(items);
        foreach (var item in items)
        {
            item.Client = clients.Where(i => i.ClientId == item.ClientId).FirstOrDefault();
        }
        return items;

The same method is used to populate the Client property and is returned in JSON for the Read, Get, and Update methods.

Thanks,

Hi @jbhakta,

Everything looks correct. Cannot check using the debugger if Client property is set? Please post also what is returned from the service call in browser network tab.

I already checked via debugger that Client property is set and there when about to return item. However, the Client property is not returned, while the other properties for that object are.

image
image

Thanks,

Can you post a screenshot from your browser network tab what is returned for this service call?

Do you mean what's returned from the GetClients() call? Client has ClientId and Name properties.

This is not result from create method execute. Please post the result from POST service call.

I posted that screenshot already in the earlier reply. Just omitted showing a few properties.

image

Please send us an example project to info@radzen.com where we ca reproduce and debug the problem.

Hi Jatin,

We think that we've fixed the problem. In the upcoming release of Radzen (before the end of this week) Created() result will be returned always with path including the case of composite primary keys. For example:

return Created($"odata/Northwind/RolePermissions/(RoleName={item.RoleName},PermissionId={item.PermissionId})", item);