You want to use the following
Story story = StoryProvider
.Columns("StoryID", "Title", "BGColor", "Summary", "VideoId", "Description", "Image", "AniProp")
.TypedResult // This is Kentico method
.FirstOrDefault(); // This is a System.Linq method
All of the auto-generated classes for each Page Type you create will work with
T is your custom Page Type.
You can learn more about how to use
DocumentQuery<T> in the documentation
There are a lot of methods and not all of them are in the documentation, but here are a couple of blog posts that might help:
https://dev.to/seangwright/kentico-12-design-patterns-part-14-documentquery-and-objectquery-tips-2c7h (shameless plug for my own blog)
DocumentQuery<T> data access pattern was added to Kentico back in Kentico 8. Here is a post about it when it was first released that might also be helpful:
In the code snippet I provided above you can see I used a combination of Kentico's querying methods and
System.Linq. There is also a
.FirstObject property that can be found when working with
DocumentQuery<T>, but it has been deprecated and using
.FirstOrDefault(); is the recommended approach.
You can see I used
.TopN(1) as well. This isn't required, but it is a good practice to use this method when you want only 1 result.
.FirstOrDefault(); gives you the first object of the collection in memory, whereas
.TopN(1) ensures only 1 result is brought back from the database to memory.