How to create an OliveLite App

  1. Start with creating a new ASP.NET MVC 3 Project in the solution. Name the project so that it reflects what the plugin is about. On the 'Project Template' dialog select the 'Empty' template and make sure that the View Engine selected is Razor. You can optionally create and use th Unit Test project, but to keep things simple we won't talk about the tests here. Click 'Ok' to create the project in the solution.
  2. Add a reference to Core
  3. Copy the AreaRegistration.cs file from any other module into the root of the new project and make modifications as self evident. Pay special attention to setting up the default controller and action.
  4. Copy the '[assembly: PluginViewLocations(' section from another app's AssemblyInfo.cs file (located under Properties) and make self evident modifications. You will need to add 'using Core.Plugin' at the top of the file to resolve the reference to PluginViewLocations.
    1. If you wish to include content in search index you will have to set the option 'IsIndexedYN' to 'Y' and include a Reindex action in your Admin Controller.
    2. You can tweak the 'AdminPermission' and 'UserPermission' to reflect your security requirements for your app
  5. Add an Empty Controller named appropriately (based on your settings in the previous bullet, usually AdminController). The 'Index' action should automatically be created for you. If you have opted for including content in the search index, create a 'Reindex' action with signature copied from another app.
  6. Create the 'Index' view, by right clicking the 'Index' action in the controller code and selecting 'Add View'. Make sure you have Razor as the View Engine and all check boxes unchecked.
  7. Replace all the contents of the newly created View with '<p>This will be the Admin Tool</p>' (of-course minus the quotes).
  8. Like wise create the content controller as defined in the PluginViewLocations with the proper action and a view to go with it.
  9. Change the 'Build Action' property of the 2 views you just created to 'Embedded Resource'
  10. Right click your app project, select Properties and then the Build Events tab. Type [copy "$(TargetPath)" "..\..\Core\bin"] (minus the square brackets) in the Post-build event command line field.
  11. Now "Rebuild' your solution, and execute Core. In the browser navigate to 'http://<yourdevserver>//<yourappname>' replacing the appropriate values and you should be seeing the view as defined by the content / action settings you made above.
  12. Before testing to make sure that the Admin views show up, be sure to include this App in the list of Apps for the Business Unit you are testing with.

From here on developing the App is like developing any other mvc application. Keep in mind that you should not define any master layout in your app as that will be provided by Core.

Back to Plugin Architecture

Last Modified 4/27/2012 4:18 PM by Deepak Chitnis