ValcomWeb Content Management Website
ValcomWeb is a web application to allow control over web content displayed and to keep the web site fresh with new content and images. This is a simple
content management system where all the data is contained in a database.There is an identity management system to ensure that content is only created by individuals with the appropriate authority. It also allows managers to enter actual position requirements for display to prospective employees or consultants. Finally it will accept applications for those positions with resumes included as part of an submission form.
The system uses ASP.Net version 5 and Model View Controller (MVC) 6 as the core framework for development. At the time of creation this is at beta 7 release. The database access uses Entity Framework (EF) version 7, which is also at a beta 7 release. System Authentication is managed by Microsoft Identity version 3, also in beta 7 version. Other architectural elements that are standard with ASP.Net are:
- dnvm - .Net Version Manager
- dnx - .Net Execution Environment
- npm - Node Package Manager
- dbms - MS SQL Express or SQLite
There are also a number of addon that are used as part of the architecture these are:
- Font Awesome icons
- summernote - jquery addon editor
- vticker - jquery addon scroller
- typed.js - jquery addon marquee
- multi-select - jquery addon select
- PreventGhostClick - jquery addon
All of the tools used in the coding of this application are Open Source
There are 3 possible execution architectures. The first is Windows using IIS on a Windows Server with SQL Express or SQLite. The second possible architecture is using Windows but replacing IIS with Kestrel. The third architecture is either Linux or Mac OS X using Kestrel and SQLite.
ASP.Net 5 has dual target environments. The first is a normal MS .Net Framework environment using version 4.5.1 or higher. The second environment is a Linux or Mac OS X environment using version 4.6.0 Core Framework. This second environment has about 95% of the the Microsoft Windows environment implemented at this time, with a target of 98%+ within a year. The main elements not yet implemented are network based elements, where the Linux and Mac use different capabilities than are available within Windows. The most important missing elements are the ability to send emails on the non-Windows environments, which means that a send mail implementation must be developed using lower-level calls than are normal in an ASP.Net application. The standard web server is a variant of IIS, either full IIS or IIS Express. But there are 2 alternate web servers available, one for Windows and one for Linux.
Documentation for this framework is at http://docs.asp.net This documentation is a work in progress with new topics being added daily now.
Model-View-Controller (MVC) 6
The separation of concerns into data model, web page display and an element that controls data access and data population of a view or data extraction from a view. This minimizes impact when one part of a program changes and ensures that the location for the changes to be implemented are clearly understood. The data model can be implemented in a database or by a file storage system. The data model may also be extended to have models that are only used in the views where there is a combination of data from persistent storage to temporary data views for display to the user on a web page. The creation of the actual web page for display to the user is the responsibility of the view. This will take the supplied data and format it for HTML5 output using a web server supported by ASP.Net 5. The business logic of the application is managed by the controller, where data is taken from the model and supplied to the view as need. Separate classes may be created for business logic that are then accessed by the controller. Also data classes may have data logic implemented as well.
The MVC framework relies heavily on a set of conventions for naming of Controllers and Actions within Controllers tied to Views and folders within Views where those folders match the name of the Controllers they work with and the names of the Views themselves match the name of the Actions in the Controllers.
Entity Framework 7
The Entity Framework is responsible for abstracting the management of a Database Management System away from the developer and is responsible for much of the programming efficiencies of ASP.Net over other development environments. Entity Framework automatically creates the program to create the data tables in a database. There is support for SQL and NoSQL databases in entity Framework, so you can pick whichever best suites your needs and environment. There is support in Entity Framework for writing queries in Structured Query Language ("SQL"), but it is not possible to write direct NoSQL queries. Normally all data access is done using Language Integrated Queries (LINQ), which is suitable for 99% of all data queries. EF 7 is a complete rewrite from the prior version, EF 6. As such, it does not have all the same capabilities of EF6 yet. EF 7 is only suitable for system where the need for complex transactions is not required.
Microsoft Identity 3.0
This is an OAuth based implementation of Identity Management. It is a non-Windows based implementation where User Ids and hashed passwords are stored in a database. The User Ids are email names rather than person names, which is necessary so that there is interoperability between all the possible OAuth providers. In addition to the local database provided identity management, this system works with Facebook, Google and Twitter where the login from any of those systems can be configured to work with the identity management for this application. However, this capability for external identity provider support is not required or used in this application at this time.
All code exists locally and in a cloud repository, using Visual Studio Online. The repository format is Git. The url for the repository is https://jwdavidson.visualstudio.com/defaultcollection/_git/ValcomWeb2New Git was chosen over Team Foundation Server as this is not an option in the open source Visual Studio Code, which is needed for Linu and Mac OS X development.
Visual Studio provides a template which pre-populates many of the files and folders to start building an ASP.Net 5 applicatioun using MVC 6. This same functionality is available in Linux and Mac OS X using the scaffolding tool, Yeoman
The sections below will be expanded in separate topics with links added as the topics are created.
Configuration files in an MVC 6 application are contained in the file Startup.cs and in various *.json files and some other miscellaneous files, all of which are listed below:
- Startup.cs ValcomWebStartup - contains programmatic based configuration items;
- config.json - contains various application settings and data connection strings
- package.json - contains a list of packages used by gulp
- project.json - contains a list of framework libraries used by the application
- bower.json - contains a list of packages that are managed by bower
- hosting.ini - contains settings used by Kestrel
- web.config -> app.config - contains settings used by the web server
- gulpfile.js - contains settings used by gulp to process files for build and publish
There are 2 kinds of data models: those that have data persisted in the database and those that convert persisted data to classes used by Views. Microsoft provides 2 files in an Identity using MVC application: the file IdentityModels is used to hold the dbContext and the definition of the data sets that are persisted; and the file AccountViewModels holds the definitions of data used for managing accounts, though all of this data is used by abstraction Managers.
Representative files are discussed in detail:
- AccountViewModels - holds data definitions for various Views used to access the Identity system;
- IdentityModels - holds the dbContext and data set definitions for persistence;
- HomePageData - holds the definition of classes used to persist the Home Page of the website;
- HomePageDataView - holds the classes used by the View that actually shows the Home Page of the website;
- HomePageEditorView - holds the classes that the Editor uses to describe the photos and text displayed in the Home Page of the website;
- Position - holds the definition for the manager created Positions.
Migration files are all created by Entity Framework to manage the database and to show the individual changes in each iteration. The numbers at the start of migration class files represent the year, month, day, hour, minute and seconds when the file was created. There are 2 parts to each file: the class itself and the designer file.
- InitialSchema - this is the original file used to create the database and initial tables
- OfficeContactDetailUpdate - this modifies the Office Contact Detail
- ApplicationDbContextModelSnapshot - this describes the current state of the entire database
The migration files are database provider specific. The files generated for SQL Server are different from those generated for SQLite.
Repositories are a means of abstracting data interactions of Entity Framework so that different implementations can be injected to allow testing of the model / controller interaction and to standardize calls to the database.
- HomePageDataRepository - this repository gets data associated with the Home Page of the website;
- PositionRepository - this repository manages the Postion data used by the Managers to display Valcom requirements
The controllers are responsible for getting data from the database, using the appropriate logic and making it ready for display in the required Views.
- HomeController - manages the actions for the Home Page of the website
- PositionController - manages the actions for creation and display of Positions describing the Valcom requirements
- EditorPortalController - manages the data for each website page
View files are what generate the actual html displayed by the website. These files are are a mix of html code and Razor code
- _ ViewStart - tells which file to use as the main wrapper
- _ ViewImports - a file to hold common using references for all other views
- _Layout - a file which holds the common layout for the website. Ensures all pages have the same look and feel.
- _ PortalMenu - the menu for the admin portal
- HomeIndex - the view for the landing page
- PositionIndex - the View that lists all positions created by the Manager accessing the page
- PositionAddNew - View that lets a Manager create a new position
- PositionDetail - View that shows the Manager the full content of the Position
- PositionEdit - View that lets a Manager Edit the content of the Position
- PositionDelete - View that lets a Manager delete the Position specified
- EditorPortalHomePageEditor -
jQuey and Bootstrap files
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.