My favorites | Sign in
Logo
                
Search
for
Updated Jan 12, 2009 by esteewhy
Explorer  

N2 Explorer

What is N2 Explorer

N2 Explorer is a Windows Forms application, aimed at the very least to resemble the functionality of a standard N2 administrative web interface (~/Edit). Conceptually, it should be a good basis for any desktop-based application that targets N2 framework.

Note 1: In it's present state, N2 Explorer allows opening existing N2 database in a read-only mode. That is, no saving is implemented, at aLL :=(. Nevertheless, the application gives a good insight into a data model, providing a generic interface for exploring ContentItemS hierarchy, DetailS and DetailsCollectionS.

Note 2: Because of the need to know all the assemblies that provide a ContentItem types in a given database, configuring the application might seem quite a tricky job. Sorry for that, hopefully, if will improved.

Notice, how the same data on the picture shown above, looks like on the original site in edit mode:

How does N2 Explorer work (it's about internals)

N2 Explorer works much the same way a usual N2-powered site does, by instantiating ContentEngine manually and accessing it's Persister property to retrieve items. But, because it's a usual Windows application and it cannot access some ASP.Net runtime information, N2 Explorer asks user to provide a path to web.config file. It takes n2 configuration from this file than. Also N2 Explorer assumes that this web.config lives where Web Site Root is, that is: it calculates ~/ path from there. The latter is used, for example, to retrieve ContentItem icons. Also, a given web.config path is used to guess an absolute location of |DataDirectory| definition (~/App_Data/), in case a given connection string uses it. For data rendering N2 Explorer uses an extremely powerfull .Net Framework feature of TypeDescriptor, TypeConverter and TypeEditor classes customisation. It enables a quick and detailed representation of arbitrary data inside a PropertyGrid control.

Configuring and using N2 Explorer (high-level usage)

  1. Start the application -- configuration dialog will appear
  2. First, specify a path to a web.config file of the N2-powered application you'd like to open:

  1. Next, choose all the assemblies that contain a types which might occur in a database being opened. This is a trial and error process for now. You have to add aLL assemblies, one by one. In case there will be some type in the database, that can not be resolved, an exception will be thrown and application will need to be restarted to be reconfigured once again. (For now, i just haven't learned yet how to recycle an NHibernate session correctly.) The good news is that the configuration is saved each time OK button is pressed.
The picure shows aLL assemblies which one need to choose to run a standard N2 Templates site:
  • N2.Edit
  • N2.Security
  • N2.Templates
  • System.Data.SQLite
  1. If a main window with a tree view appeared, than try to expand it. If an exception will be thrown, you'll have to inspect a details and add a necessary assembly to configuration.
  2. Finally, if the tree has fully expanded without errors you may explore content items properties, details, and detail collections.


Sign in to add a comment
Hosted by Google Code