Customizing the ASP.NET Core code C# Parial Class

New to using radzen.
Radzen is not compiling code?
I created a partial controller asp.net core to extend server controller, but it doesn't seem to be getting compiled or showing up in radzen to invoke the call I added.

using System;
using System.Net;
using System.Data;
using System.Linq;
using Microsoft.Data.SqlClient;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNet.OData;
using Microsoft.AspNet.OData.Routing;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.AspNet.OData.Query;

namespace SupAliAdminSite.Controllers.SupAliDb
{
using Models;
using Data;
using Models.SupAliDb;
[ODataRoutePrefix("odata/SupAliDB/SupaliCustodians")]
[Route("mvc/odata/SupAliDB/SupaliCustodians")]
public partial class SupaliCustodiansController : ODataController
{
[EnableQuery(MaxExpansionDepth = 10, MaxAnyAllExpressionDepth = 10, MaxNodeCount = 1000)]
[HttpGet("{User_Name}")]
public SingleResult GetSupaliCustodianByName(String key)
{
var items = this.context.SupaliCustodians.Where(i => i.AspNetUser_ID == key);
this.OnSupaliCustodiansByNameGet(ref items);

        return SingleResult.Create(items);
    }

    partial void OnSupaliCustodiansByNameGet(ref IQueryable<Models.SupAliDb.SupaliCustodian> items);
}

}

SupaliCustodiansController.zip (1.9 KB)

Hi @BillP,

Custom methods added to the OData controllers will not appear in the Invoke data source method options. Radzen only lists the ones it has generated. You probably need a custom method.

1 Like