how to generate classes for custon table?

Muhammad Kaleem asked on April 11, 2019 19:36

i have add a table in custom table application also i have save code for custom table but it generates only one class how can i generate provider class as well to get data from table, please suggest thanks

Correct Answer

Brenden Kehren answered on April 11, 2019 19:51

There is no provider class it generates, only the strongly typed class. You need to use the CustomTableItemProvider class to get data.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Muhammad Kaleem answered on April 11, 2019 19:53

thanks Brenden for your reply, im following this document https://docs.kentico.com/k12/developing-websites/retrieving-content-in-mvc-applications#RetrievingcontentinMVCapplications-Retrievingcustomtabledata

in document he is using provider class to get data, please suggest thanks

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 11, 2019 20:37

In the documentation look at this line:

SampleTableItem item = CustomTableItemProvider.GetItem<SampleTableItem>(1);

This will return a strongly typed SampleTableItem custom table item object with ItemID of 1. The CustomTableItemProvider is generic and will get any custom table item object you tell it to. Check out the Custom Table API Examples.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.