atomsite.net

The AtomPub server for .NET

News Blog - Browsing MVC

  1. AtomSite 1.4 Update in Web Platform Gallery

    downloadpage AtomSite is now up-to-date in the Web Platform Gallery aka microsoft.com/web.  This makes it incredibly easy to install AtomSite and have IIS7 configured. This is why on our new download page we have it marked as the featured way to download AtomSite.

    When you install AtomSite using through the Web Platform Gallery, it automatically ensures you have ASP.NET MVC installed and that the file permissions are set appropriately.

    Going forward, we plan to have more experimental versions.  Each time AtomSite is at a stable point, we will push that version the Web Platform Gallery.

    Did you install from the Web Platform Gallery? Let us know your experience!

    Posted by JarrettV on April 15 at 5:32 PM

  2. Plug-Ins and Dynamic Controllers

    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.

    Posted by JarrettV on February 11 at 11:57 PM

  3. Update to ASP.NET MVC RC1

    I've checked in the code to update BlogSvc to ASP.NET MVC RC1 Refresh.  There were only minor updates to get things workings and the overall process only took around 10 minutes.  However, the readme notes on the configuration are misleading.  The release notes tell you to update the pages section to look like:

    <pages

    validateRequest="false"

    pageParserFilterType = " System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 "

    pageBaseType = " System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 "

    userControlBaseType = " System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35 " >

    This is not necessary as you'll notice when creating a new MVC project that three bolded lines are not included.  When I added the lines to my config it caused errors on my hosting provider.

     

    Update: yes, the readme notes are very misleading.  These lines should actually be added to the web.config file in the "Views" directory.  I added these lines to web.config file in the themes folder.

    Posted by JarrettV on January 31 at 12:05 AM

  4. Routing Updates

    Routing I just checked in a large refactor on the routing system to allow for collection plug ins to register their own routes.  All routing implements the IRouteRegistrar interface that has a RegisterRoutes method.  The BaseRouteRegistrar abstract base class contains some useful implementation and logic that can be reused for plug-in routing.

    AtomPubRouteRegistrar the implementation for all the default routes.  The default routes will always get registered after plug-in routes.  Remember, order is important because routing always takes the first match.

    Each collection can plug-in their own routing with a constraint that will ensure the routes are only active for the collection/collections that registered the routes.

    Also, I added some extensions on top of UrlHelper that calls the RouteService class which has support for SSL routes and absolute routes.  We lost automatic deep routes on threaded annotations. However, there's baked in support for "dated" entries.  We are using named routes so that makes it really easy to select which route you want when generating the URL.

    Posted by JarrettV on January 23 at 10:30 AM

  5. Refactor for Extensibility

    Update: Some of the content of this post is outdated.  The whole plug-in system was greatly revised to support better extensibility scenarios.

    One the features we are working towards in 2009 are Collection Plug-ins.  The goal is to utilize the extensibility of AtomPub so that it is possible to layer any kind of collection on top of it.  This is being done by Google, Microsoft, and many others for providing things such as calendars, contacts, photo galleries, etc.

    By using a combination of ASP.NET MVC, dependency injection, and extensibility points, we hope to allow any type of collection to be stored on top of AtomPub.  To accomplish that, I'm moving towards a design where all collections are built according to IAtomPubService interface.  This interface describes the base functionality needed by any collection.  The methods in gray are extensions to the AtomPub standard which I consider a core need for managing any collection.  I'm have considered splitting this interface into a couple smaller pieces.

    public interface IAtomPubService
    {
      AppService GetService();
      AppService UpdateService(AppService service);
      
      AtomFeed GetCollectionFeed(Id collectionId, int pageIndex);
      AtomFeed GetFeed(Id collectionId, int pageIndex, int pageSize);
      AtomFeed GetFeedByAuthor(Id collectionId, string authorName, int pageIndex, int pageSize);
      AtomFeed GetFeedByContributor(Id collectionId, string contributorName, int pageIndex, int pageSize);
      AtomFeed GetFeedByPerson(Id collectionId, string personName, int pageIndex, int pageSize);
      AtomFeed GetFeedByDate(Id collectionId, DateTime startDate, DateTime endDate, int pageIndex, int pageSize);
      AtomFeed GetFeedByCategory(Id collectionId, string term, Uri scheme, int pageIndex, int pageSize);
      AtomFeed GetFeedBySearch(Id collectionId, string term, int pageIndex, int pageSize);
    
      AppCategories GetCategories(Id collectionId, Uri scheme);
    
      AtomEntry GetEntry(Id entryId);
      Stream GetMedia(Id entryId, out string contentType);
    
      AtomEntry CreateEntry(Id collectionId, AtomEntry entry, string slug);
      AtomEntry CreateMedia(Id collectionId, Stream stream, string slug, string contentType);
      event EntryEventHandler EntryCreated;
      
      AtomEntry UpdateEntry(Id entryId, AtomEntry entry, string slug);
      AtomEntry UpdateMedia(Id entryId, Stream stream, string contentType);
      event EntryEventHandler EntryUpdated;
      
      void DeleteEntry(Id entryId);
      void DeleteMedia(Id entryId);
      event EntryEventHandler EntryDeleted;
      
      string GetEntryEtag(Id entryId);
      string GetMediaEtag(Id entryId, out string contentType);
      
      AtomEntry Annotate(Id entryId, AtomEntry entry, string slug);
      AtomEntry MediaAnnotate(Id entryId, Stream stream, string slug, string contentType);
      event EntryEventHandler Annotation;
    
      AtomFeed GetAnnotations(Id id, bool deep, int pageIndex, int pageSize);
    }
    

    We will provide a base implementation (AtomPubService) to this interface that contains only logic required by the AtomPub standard.  Collection plug-ins can either extend this base implementation or create a new collection service from scratch against the IAtomPubService interface.  For example, a blog collection may extend the AtomPubService to include blog related methods such as ApproveEntry or SendTrackback.

    There are some additional methods that may need to be added to support the core infrastructure.  For example, a collection should be responsible for registering routes to the resources within that collection.  Also, a collection should be responsible for choosing the repository, authorization, and other services based on user configuration.

    Hopefully, through the magic of an IoC framework, controllers and views can be selected dynamically when I install a new collection plug-in.  For example, I want to create a collection plug-in that will allow me to create generic web pages.  Most of the logic I need already exists in the Blog Collection but I have a few changes to add support for sub-page annotations.  I just extend the BlogService class and override a couple functions.  I create a couple new views and controller actions which hit my new PageService class and I'm done.  I'm still working through this scenario, so let me know if you have any comments on the design.

    Posted by JarrettV on January 14 at 11:47 AM

  6. Wizard Release 0.8

    settings The eighth release of BlogSvc includes a new setup wizard. Also, this release contains the following new or improved features:

    • Setup wizard will test your installation on your web server
    • Setup wizard will modify your service.config and users.config
    • New green theme called "Settings" (see right)
    • All entries are cleansed from html to xhtml
    • Comments allow html only from a whitelist of tags
    • Authorized comments can use any tags
    • New support for wlwmanifest.xml
    • Entries can now be split in live writer or with <!--more--> comment
    • Collection page now only shows first part of post when split
    • New ExtendedEntriesOn setting for each collection which alters wlwmanifest.xml
    • Feeds now only show first part of post when ExtendedEntriesOn
    • Updates to jQuery rater plugin based on community feedback
    • Updated Search to use render partial
    • Updated views and partials to use strongly typed models
    • BaseController and BaseModel greatly increase view potential
    • Updated all existing entries to Xhtml
    • Remove emails from annotation feeds (to prevent spam)

    Visit the release page on codeplex to download.

    kick it on DotNetKicks.com
    Posted by JarrettV on December 24 at 1:38 AM

  7. MVC Release 0.6

    image The sixth release of BlogSvc includes the switch over to MVC preview 5. Along with this switch are the following new or improved features:

    • Improvements to markup for clean CSS themes
    • Fully dynamic theme support
    • Fix: unapproved comments filtered
    • New unapproved comment shows "need approval" message
    • Password filtering from service doc
    • Refactor away the global statics
    • BlogSvc.net website is now separate project
    • Simple personal blog included as default
    • Fix: authentication for multiple authors/contributors
    • Removed dependency on ManagedFusion URL rewriting
    • New authors added upon entry update
    • Side controls work across collection and entry pages
    • AtomPubController is fully testable
    • Better ajax support via jQuery and MVC
    • Added subtitle extension to workspace
    • Improved ratings control using jQuery plugin
    • Simplified deployment structure

    You can read about some of the benefits of switching to MVC in my previous post.

    We will put together a roadmap for future releases of BlogSvc and we would really love to hear your feedback on this release what you'd like to see in future releases.  Please leave a comment below and let us know what you think!

    You can download this release from Codeplex.

    Kick this if you find MVC + AtomPub + jQuery exciting: kick it on DotNetKicks.com

    Posted by JarrettV on October 02 at 5:34 AM

  8. Now on ASP.NET MVC Preview 5

    I'm proud to announce the next release is built on MVC.  The move to MVC has many benefits for BlogService:MvcLayout

    1. No more WCF issues
    2. Testable
    3. Simplified authentication
    4. VS.net development server support
    5. Better flexibility around themes
    6. Url rewriting no longer required
    7. Better ajax scenarios
    8. Cleaner deployment structure (see right)
    9. Less configuration required

    This website is already running on MVC and it appears overall speed has increased both on the browser and through Windows Live Writer (even on the new beta).

    If you like to discuss the change to MVC, please head on over to the discussion already in progress.

    Posted by JarrettV on September 30 at 10:03 AM

© Copyright 2010 Powered by AtomSite 1.4.0.0