atomsite.net

The AtomPub server for .NET

Plug-Ins and Dynamic Controllers

Posted in BlogSvc, MVC by JarrettV on 2/11/2009 11:57:48 PM - CST

Update: The content of this post is out of date.  The concept of plug-ins has since been expanded to support more scenarios, including widgets, plug-ins, and controllers.

The next release contains new support for plug-ins as described in previous posts.  Plug-ins are supported using the Dependency Injection framework StructureMap.

The following types are pluggable:

Service Level Plug-ins Default Type Collection Plug-ins Default Type
ILogService NLogService IRouteService AtomPubRouteService
IController N/A IAtomPubService AtomPubService
IUserRepository FileUserRepository IAnnotateService AnnotateService
IAppServiceRepository FileAppServiceRepository ICleanContentService XhtmlCleanContentService
IAtomEntryRepository FileAtomEntryRepository    
IMediaRepository FileMediaRepository    
IAppCategoriesRepository FileAppCategoriesRepository    
IAuthorizeService ServiceAuthorizeService    

The Service Level plug-ins can all be controlled using the <StructureMap> configuration section in the web.config file.

The following example shows how to set properties on the blog collection to use the Blog Plug-in:

BlogPlugin

The RouteService registers routes on the collections first.  Then it registers the default routes.  Special care must be taken when registering routes so they occur in the correct order.  Also, plug-in routes should take care to use the collection constraint so that routes are properly overridden only on collections using the RouteService plug-in.

Controllers are dynamically instantiated using the StructureMap ObjectFactory.  Therefore, plug-ins can provide new routes and handle them with new controllers.  Currently, new routes are limited to collection plugins that fire the RegisterRoutes event.  This will be extended in the future to support routes outside of collections for things such as widgets.

I am currently flushing out the Widget story and I'm leaning towards a combination of techniques using PartialRequests and Modularity.  If you have any suggestions for widget support, please leave a comment below.

Comments

None.

Add Comment

Login using
Google Yahoo flickr AOL
and more
Or provide your details
Please enter your name. Please enter a valid email. Please enter a valid website.
Please supply a comment.
5.0 (1)
on 3/15/2009 7:28:27 PM - CST

Recent Entries

© Copyright 2013 Powered by AtomSite 1.4.0.0