Professional Documents
Culture Documents
SALEEM
Architecture
V1.0
1. Brief Description
2. Aim of Document
This document is to cover the system layers based on the known standards to enhance
performance, ease control of application, reduce modifications, and manage system
mobility through applying N-Tier Methodology. Also the document will discuss
categorizing the application to the well-known modules according to the contract, and
how the solution will coordinate and array these modules according to the pre
mentioned layers.
3. Targeted Audience
This document will target mainly the NT responsible team members in order to stick to
the system architecture described. It also can target any customer of SALEEM.
4. Table of Contents
There are three primary components of an MVC framework: one or more models,
views, and controllers. These components define the response cycle of a user
interaction with an application.
NT, 2016 1
handles the overall application flow. In a web application, the
controller usually responds to HTTP GET or POST inputs, hands the
request over to the model that implements the business rules, and then
selects the view subsequently displayed to the user.
Presentation Layer
))View
Common
Layer
+ Business Login Layer
)Model(
(Controller, API Controllers)
Entities
Application Tiers
Graph 1.1.
The system will be divided into 3-Tiers pattern. Each tier layer will be represented by
one or more stand-alone but cooperative DLLs. These dlls are deployed with the
presentation layer folder plus a helper library called Core.
Also MVVM is used for better organizing View code, and for SPA.
Common: is a helper DLL that all the layers can use which contains of:
The system constants and logic constants.
NT, 2016 2
public class SettingsMapping
{
public struct Country
{
public static string EntityName ="[Settings].[CountryName]";
public static string CountryCode ="[Settings].[CountryCode]";
}
public struct Area
{
public static string EntityName ="[Settings].[AreaName]";
public static string Description = "[Settings].[Description]" ;
public static string IsActive ="[Settings].[IsActive]";
}
File for each database schema contains all schema tables and fields as in
database that can be used in quires and database manipulations.
NT, 2016 3
Data
namespace Amad.Saleem.Common.Data.Settings
classes which represent each database table.
{
[DataContract]
public class CountryLight
{
public CountryLight () { }
public CountryLight (byte id, string countryName)
{
Id = id;
CountryName = countryName;
}
[DataMember]
public byte Id { get; set; }
[DataMember(IsRequired = true)]
public string countryName { get; set; }
}
[MetadataType(typeof(CountryMetaData))]
public class Country: CountryLight
{
public Country () { }
public Country ( int id, string contryCode, string
countryName, string description, bool isActive): base(id,countryName)
{
ContryCode = contryCode;
CountryName = countryName;
Description = description;
IsActive = isActive;
}
[DataMember(IsRequired = true)]
public string ContryCode { get; set; }
[DataMember(IsRequired = true)]
public string CountryName { get; set; }
[DataMember(IsRequired = false)]
public string Description { get; set; }
[DataMember(IsRequired = true)]
public bool IsActive { get; set; }
}
public class CountryMetaData
{
[ScaffoldColumn(false)]
public int Id { get; set; }
[Display(ResourceType =
typeof(Resources.Settings.DataAnnotations), Name ="CountryName")]
[Required(ErrorMessageResourceType =
typeof(Resources.Settings.DataAnnotations), ErrorMessageResourceName
="RequiredCountryName")]
public string CountryName { get; set; }
[Display(ResourceType =
typeof(Resources.Settings.DataAnnotations), Name ="CountryCode")]
[Required(ErrorMessageResourceType =
typeof(Resources.Settings.DataAnnotations), ErrorMessageResourceName
="CountryCode")]
public string CountryCode { get; set; }
[Display(ResourceType =
typeof(Resources.Settings.DataAnnotations), Name ="IsActive")]
public bool IsActive { get; set; }
}
}
NT, 2016 4
Common also contains ViewModels which are transferred between
Business and APIs.
Data Access Layer:
This layer is responsible for any database access, means that there's
no access either reading or saving can be done to the DB except
through this layer as it acts as the DB interface.
It contains two correlated subsystems:
DB Handler: this sub-layer acts as generic low level Handler to
the DB, it means that this layer is designed for the main
operations for any access to any DB when executing any data
instruction i.e.(insert, add, update and delete) and concerns with
the connection and transaction handling.
DB Infrastructure (Named Data Access): This sub-layer acts as
more specific layer to the DB entities by creating a class for each
DB entity.
public
Here are static
sampleCountry
of Data Get(int
Access countryId)
class methods representing the
public static AdvancedList<Country> GetList()
Project
public Table in AdvancedList<Country>
static the DB with functions signatures:
GetActiveList()
public static CountryLight GetLight(int countryId)
public static AdvancedList<CountryLight> GetLightList()
public static AdvancedList<CountryLight> GetActiveLightList()
public static ResultType UpdateList(AdvancedList countries)
private static ResultType Update(Project country)
private static ResultType SetActivation(int[]areaIDs,bool active)
public static ResultType AddList(AdvancedList countries)
private static ResultType Add(Project country)
public static ResultType DeleteList(int[] countryIds)
public static ResultType Delete(int countryId)
These Classes are formatted as the types and names of the tables'
fields in DB. By the Data Access Layer you can access any
AdvancedList (representing a set of one entity classes), or entity class
(representing one record).
Related classes are grouped into namespace with the module name.
DB tables and field names are typed through data classes, so no one
can write explicitly any table or field name.
Generic functions are generated through the DAL-Generator like: (Get,
Get List, Add, Add List, Update, Update List, Delete, and Delete List).
Any advanced functions you should write by following the rules.
NT, 2016 5
To implement a function to get only one record you should use the
single Name Category.GetBy (Name), Category.GetBy (Code).
To implement a function to get a record list you should use the plural
Name Category.GetListBy(Department).
There is only one Add and Update function and this is the abstraction
we need to, in order to maintain standardization and secure methods
and to reduce maintenance, so when you need to update any record in
the DB you just call the Category.Get method getting the AdvancedList
and update as much as you need of the fields then call the
Category.Update again with the modified AdvancedList.
Business Logic Layer:
This Layer is concerned with any business rules, methodologies
Actually this layer is the system.
This layer is changed in MVC applications to be inside the presentation
layer.
It contains two types of Classes:
Any business rules, validations, checks, calculations, or collecting
should be done here.
Naming of the functions is according to business needs with respect to
ordinary naming rules discussed before.
No SQL statements can be written in the Business Logic as well as
handling presentation controls events.
namespace
This Amad.Saleem.BusinessLogic.Settings
is sample for Business methods
{
public class Country
{
public CountryViewModel Get(short id) { }
NT, 2016 6
Server Controllers:
MVC or Normal Controller (System.We.Mvc.Controller).
Provides methods that respond to HTTP requests that are made
to an ASP.NET MVC Web site.
Use Controller to render your normal views.
API Controller (System.Web.Http.ApiController).
Defines properties and methods for API Controller.
Api Controller action only returns data that is serialized and sent
to the client.
namespace
Api Amad.Saleem.Presentation.Areas.Settings.Controllers
Controllers are specialized in returning data. For example,
{
they take
publiccare
classofApiCountryController
transparently serializing the data into the
: ApiExtendedController
{
format requested by the client. Also, they follow a different
[HttpGet]
routing scheme by default (as in:
public CountryViewModel mapping URLs
Empty() { to actions),}
providing[HttpGet]
a REST-full API by convention.
public CountryViewModel Get(short id) { }
[HttpGet]
public CountriesViewModel GetList(int start, int end, string
searchValue, string orderby, string dir) { }
[HttpPost]
public ResultType Add(CountryViewModel model) { }
[HttpPut]
public ResultType Update(CountryViewModel model) { }
[HttpPut]
public ResultType SetActivation(SetActivationKeysList<byte[]>
list) { }
[HttpDelete]
public ResultType Delete(byte id) { }
[HttpDelete]
public ResultType DeleteList(KeysList< byte []> list) { }
}
}
NT, 2016 7
Containing folders like below:
NT, 2016 8
b. Response cycle of a user interaction with an
application.
Graph 1.2.
Simple view to show how request go through layers till it backs to the client
As html response. O
P
S
A Data Access
j API
Controller Managers
a
` Client
Hx J BLL
User Interface t Angular (Bind) s
Html mR o
leU nH
qR
Angular (Routes) t
uL t
MVC
e( p Controller
V DB
s
i
t
e
w
Common Entities (Table Representation)
R
e
Graph 1.3. n
d
e
r
e
d
P
a
NT, 2016 9