Marthin Freij
Feb 11, 2010
(0 votes)

Configuring page provider capabilities

Page providers requires some configuration. In addition to the obvious ones like name, type and entryPoint you should also define what capabilities your page provider supports, such as Create, Edit, Delete and Search. If you, for example, specify that your provider does not support delete, all delete related ui in edit mode will be disabled for your providers pages. More details on capabilities can be found in the Configuration section of the Page Provider Tech Note.

In almost all examples I have seen for page provider configuration, capabilities are specified in web.config. In my opinion, capabilities should not be defined in configuration. This could lead to, by accident, specifying more capabilities than what is actually implemented in code. I think the best place for this kind of configuration is code. Fortunately, the Capabilities property in PageProviderBase is virtual, which means you can override it and configure it there.

public override PageProviderCapabilities Capabilities
        return PageProviderCapabilities.Create | 
            PageProviderCapabilities.Edit | 
Feb 11, 2010


Sep 21, 2010 10:33 AM

Good one Martin! I totally agree with you.
/ Tom Stenius

Sep 21, 2010 10:33 AM

This is not as good if you want to provide some reusable provider. When you override Capabilities property web.config settings have no effect at all. So someone else won't be able to suppress for example Delete or Create later. I think implementation should be like this:

Math.Min( base.Capabilities & (int)PageProviderCapabilities.Create,
(int)PageProviderCapabilities.Create ) |
Math.Min( base.Capabilities & (int)PageProviderCapabilities.Edit,
(int)PageProviderCapabilities.Edit ) ...
/ Vlad

Please login to comment.
Latest blogs
Performance optimization – the hardcore series – part 2

Earlier we started a new series about performance optimization, here Performance optimization – the hardcore series – part 1 – Quan Mai’s blog...

Quan Mai | Oct 4, 2023 | Syndicated blog

Our first steps into local AI

After a consumer of tools like ChatGPT and CoPilot, we as developers like to dive deeper into it. How does it work? Where to start? Can I create my...

Chuhukon | Oct 4, 2023 | Syndicated blog

Update on .NET 8 support

With .NET 8 now in release candidate stage I want to share an update about our current thinking about .NET 8 support in Optimizely CMS and Customiz...

Magnus Rahl | Oct 3, 2023

Adding Block Specific JavaScript and CSS to the body and head of the page

A common requirement for CMS implementations includes the ability to embed third party content into a website as if it formed part of the website...

Mark Stott | Oct 3, 2023