Download the latest source code for this article on Code Project (opens in new window)
Download the latest release from Code Plex (opens in new window)
Introduction - What is the Genesis Smart Client Framework
The Genesis Smart Client Framework is a application development framework that allows
developers to develop modules of code that is hosted inside of the framework. The
framework takes care of user security, application deployment and online data access
for the developer as long as they use the Genesis Smart Client Framework API.
This article is part II of VII. Go to part I to
see the index.
Please refer to our web site www.bluemarble.co.za
for the most up to date information about the Genesis Smart Client Framework or
any of our newsfeeds.
News feed
Development feed
View our blog
Follow our tweets
In order to pursue our active interest in releasing this version of the Genesis
Smart Client Framework as an open source product, we've created a profile on
www.codeplex.com where we maintain the most recent copy of the source code.
If you want the latest version of the Genesis Smart Client Framework source code
go to our code plex profile
or download the latest release from Code Plex.
The Back-end
The Genesis Smart Client Framework has a comprehensive server-side back-end that
enables client access to the configuration meta-data, file access, web services
and the database.
Configuration Meta-Data
The Configuration Meta-Data is information that describes the user access profile.
The user access profile is built up by analysing the user's security role access,
then it searches for modules and commands that are visible to those roles. The results
are sent to the Smart Client which is then responsible for displaying an user
interface which contain only the configured menu and toolbar items. The Configuration
Meta-Data also contains the login XML script to be executed after the user has successfully
authenticated.
Configuration is done by managing the modules that are hosted inside of the Genesis
Smart Client Framework, finding any commands that they contain and assigning security
roles that are allowed to access the module/command.
* Commands are snippets of code contained in a module that can be secured to prevent
execution by unauthorized users. This will be clarified in Part IV.
File Access
The Smart Client uses the file access system to download the latest version of
any modules hosted in the Genesis Smart Client Framework. The file access system
is a ASP.NET web site that exposes files to the Smart Client, it allows files
to be uploaded to the server by means of the Web Services. When deploying new code
to the framework the developer will use the deployment function of the file access
system which will automatically udpate the relevant configuration meta-data. Database
backups are also made available through the file access system.
Web Services
The Web Services provides the business logic that enables the Smart Client application
to access the Configuration Meta-Data, and to interact with the Genesis Smart Client
Framework core system. The Web Services is a ASP.NET Web Service site that exposes
the web services to the Smart Client. There are base classes available for the
developer to inherit for his/her own services that comply with the API. All online
data access has to happen through Web Services to conform to the Smart Client requirements.
The Web Services also allow the developer to access the File Access system for uploading
and downloading files from the Genesis Smart Client Core system.
Databases
The Genesis Smart Client Framework's database is a Microsoft SQL Server 2008 database
that contains all of the user and security information. It also contains the Configuration
Meta-Data for the modules and commands hosted by the Genesis Smart Client Framework.
There is a collection of CRL Stored Procedures and TSQL Stored Procedures and views.
If a developer needs to access information in the Configuration Meta-Data database
they can use any of the available views through linked servers.
Multiple application databases are supported by the Genesis Smart Client Framework
and can be access through the Web Services. Currently there is only support for
Microsoft SQL Server 2008 databases.
The Client
The Smart Client application authenticates the user through the Web Services and
updates itself by analyzing the Configuration Meta-Data for the authenticated user.
Once the application is up to date, the user login XML script is executed and the
user environment is prepared. The Genesis Smart Client Framework delivers a rich
user experience by integrating a Microsoft Office 2007 styled ribbon with an intuitive
navigation system.
Loader Application
The Loader application is a generic file synchronization utility. It checks an online
XML file for available applications and their version numbers. It determines via
a local cache if it has the required file(s) or if it has the latest version of
said file(s). If the file needs to be updated, the Loader will download the file
and update the local cache. Once the Loader has completed the synchronization it
executes the default application.
The Loader is not the Smart Client application, the Loader is responsible for
ensuring that the Smart Client application and any supporting resources are up
to date.
The Smart Client
The Smart Client application is responsible for authenticating the user, downloading
the Configuration Meta-Data for the authenticated user. Downloading the most recent
module libraries and supporting resources, and then to render the personalised user
interface. It also manages the local execution of commands contained in the modules.
Unless a user has the required security access, the Smart Client will not execute
the code.
By referencing a set of client API's, the developer can develop a module with full
integration into any Smart Client. The libraries contain all of the interfaces
that the default Smart Client implements. In part IV you will learn how to write
your own Smart Client implementation. Any module developed using the Genesis Smart
Client Framework client API will function on any Smart Client application developed
using the Genesis Smart Client Framework client API.
Programming Concepts
In order to provide a managable application framework some fundamental programming
concepts have to be created and enforced. When a developer has to work within the
bounds of a framework, it is not a good idea to restrict what the developer can
achieve with his/her code. The framework development requirements have therefore
been kept to a minimum.
Module
A module is a unit of code that the developer can host inside of the Genesis Smart
Client Framework. A module is composed of a Smart Client library, Web Services
and possibly a Database and/or Web Site.
The Smart Client library is a class library project that references the Genesis
Smart Client Framework client API's. A Smart Client library is composed of Windows
Forms, Web Service client proxies for the Web Services and Commands. The Windows
Forms are standard windows forms which are rendered on a MDI surface. In order to
access data developers must use the Web Service client proxies, which are simple
wrapper classes on the standard Web Reference code generated by Visual Studio. The
proxies handle the conversion to/from the correct types to simplify frequent access
from the code. Commands are code snippets which are secured by the framework. Data
access for the Windows Forms can be achieved through the use of Commands, however
it is not enforced.
The Smart Client application renders a custom menu for each user, this menu is
generated from the Configuration Meta-Data. The menu items are linked to Commands
which are executed by the Smart Client application. Menu linked commands usually
display a Windows Form, but can execute any function.
Command
Commands are units of code that are protected by the Genesis Smart Client Framework
security layer. A user can be prevented from executing sections of code based on
his/her user access profile. Commands are used to link code to the menu items that
are rendered by the Smart Client application. Commands can be used for any code
function that can receive parameters, and return a result. You can use a command
to access online data through the Web Services or to manipulate the local system.
[Genesis.Common.Attributes.CommandCode("Common.WebBrowser.Show")]
[Genesis.Common.Attributes.CommandDescription("This command shows the web browser")]
[Genesis.Common.Attributes.CommandName("Web Browser")]
public class ShowWebBrowser : Genesis.Common.Classes.CommandBase, Genesis.Common.Interfaces.ICommand
{
#region ICommand Members
void Genesis.Common.Interfaces.ICommand.Execute()
{
Genesis.Client.Common.Forms.WebBrowser webBrowser = new Genesis.Client.Common.Forms.WebBrowser();
webBrowser.Host = this.host;
bool hasUrl = false;
for (int i = 0; i < this.parameters.Count; i++)
{
webBrowser.PageProperties.Add(
new Genesis.Common.Classes.PageProperty(parameters[i].Name, parameters[i].Value));
if (this.parameters[i].Name == "Url")
{
hasUrl = true;
}
}
if (!hasUrl)
{
webBrowser.PageProperties.Add(
new Genesis.Common.Classes.PageProperty("Url", "http://localhost:1652/genesis.web/default.aspx?SessionGuid=" + this.host.GlobalDataSetFunctions.GetActiveSessionGuid().ToString()));
}
webBrowser.Navigate();
base.host.CreateWindow(webBrowser);
}
#endregion
}
Web Service Client Proxy
A Web Service client proxy is a class that wraps the standard Web Reference code
generated by Visual Studio into a type-safe, easy to use class. The base class that
developers have to inherit from, automatically configures the web service address
from the information contained in the Configuration Meta-Data for the user's access
profile.
Managing the Genesis Smart Client Framework
To enjoy the full benefit of the Genesis Smart Client Framework, you have to understand
how to configure the meta-data. This is the setup of the user security, the module
and command configuration, user interface and resources.
User Security
User Security is handled by a user/role system. Roles are defined in the Genesis
Smart Client Framework Configuration Meta-Data database, users are added and linked
to roles. Configured Modules and Commands are linked to roles. When a user is authenticated,
a list of modules and commands are returned to the Smart Client. The Smart Client
checks for the required files and downloads the appropriate updates. Authorised
sessions are logged in the Genesis Smart Client Framework database. Exceptions on
the Smart Client are also logged in this database.
Deployments
Updating the Configuration Meta-Data and the module libraries is done with a packaging
tool which collects all of the module information and creates a deployment package.
This package is deployed using the deployment tool which will extract the module
library and associated resources to the correct locations in the file host and update
the Configuration Meta-Data.
The packaging tool collects the library files from configured locations, which can
include the development binaries directories, and builds a deployment manifest.
The files are all zipped to create the deployment package.
The deployment tool uploads the deployment package to the server, unzips the files
into temporary directories and then executes the deployment manifest. The manifest
is a set of instructions to copy/move/replace files and to perform database functions
on the server.
Further Reading
This article is part II of VII. Go to part III
to read about the server back-end.
Other information
Blue Marble is proud to be a Microsoft BizSpark startup company.
DISCLAIMER
The Genesis Smart Client Framework is a commercial closed source application. It
is being provided on Code Project with all of the benefits that articles on Code
Project grant its users (ie. Free and Fair use), however it must be noted that some
modules contain a 3rd party control that we are unable to license via Code Project.
Once all of the articles are uploaded, the code will be extracted to a seperate
obfusicated library to protect our vendor's Intellectual Property. The full source
code will be provided for this library, excluding the few lines that could compromise
our License. An alternative will also be provided for developers who wish to use
a completely free version.
DISCLAIMER UPDATE
An implementation of a standard Microsoft.NET controls user interface has been created
and is available on Code Plex
as of release 1.30.1024.0. This release complies with all of the
Code Project article publishing terms and conditions.