Database table-valued functions in custom methods

Hello everyone

Does Radzen let you work with database table-valued functions? Is there a way to call db functions in ServerMethodsController custom methods?

Hi @luf,

According to this SO answer you have to use raw SQL with Entity Framework Core. This should work as expected in ServerMethodsController in Radzen.

1 Like

Is it possible to call it directly from the EF context?

Like for example...

 var courses = context.GetCourseListByStudentID(1)

No, Radzen doesn't scaffold functions at the moment.

In the end, I reached this solution:

  1. Created the model needed for the data the function will return

  2. Added a virtual DbSet to the Connection context class

  3. Always in the context class I've created the method that will call
    the SQL function with FromSql()

  4. Finally I can call my function directly in the ServerMethodsController class through the Conn context class.