Note: This framework is a framework that has 100% compatibility with standard MVC FOR SPRING in J2EE and MVC.NET 3.00 and is running on top of them and adds many capabilities which did not exist in this arena before.
Introduction
I always disliked webforms because of its low quality of code and also the non web nature it had. Moreover, I liked C#, but because of leaking of MVC architecture in this platform, I went to JAVA whose library we are talking about also has a JAVA (MVC FOR SPRING) component Library but I would like to introduce C# and MVC.NET version as my favorite product.
The goals of this design were:
- An application like environment in the web
- Made a Real DB Centric System and less effort in manual coding for forms
- Low weight and high quality pages
- NEVER use from
IFrame
or Popup
Windows because of their behavior (which I did it with JavaScript SandBox means: all forms you load will load in the same DOM area and they will show in a DIV
not an IFRAME
) - And many other goals: the most important was a new and standard way for development specially I like to use META MODELS against Models because Meta Models have a much stronger concept.
This system is:
- 100% full Ajax
- No refresh required at all (I repeat again, no refresh but you can redirect but also, no need to refresh the page at all)
- Upto 5 times faster Page Load
- And for the first time:
- JavaScript SandBox support Implemented in component Model (No need for Iframes at all!)
- 100% DB centric System
Compare after we have done the job.
We wrote the same code for the same reason and we tested them in three different platforms. Here, you can see the results:
As you see, MVC PLUS needs one third of MVC.NET and less than half of WebForms to spend it in development which means, less cost, more high quality code and exactly a cheaper and better product in code quality and overall.
Here, we compared these frameworks in line of Rendering size which also means less Render Time in server side which is effective if you use SSL (less cost for application server and much faster data transfer):
As you see, Average Forms rendered with MVC Plus have a size between 5 to 10 Kilobytes which is much less than other competitors, even less than half of their size in MVC.NET (Using Telerik Components).
Note: All tests passed in my friends' office, later I will publish the sample codes (these were a real product for business, so my friend might cut some parts of code).
Note that all tests were done for the similar form design in view and reason and scenario.
STANDARD MVC 3.00
In standard MVC, you have to write your models as below:
public class Person{
public string name {get ; set ; }
public string FamilyName {get ; set ; }
}
public class ADDRESS{
public string name {get ; set ; }
public string FamilyName {get ; set ; }
}
Each view can support only up to one Model, for example, you can have only Person Model or address Model accessible.
In MVC PLUS
In MVC Plus, you have to declare your Models separated from Meta Models and Meta Models will be used in Controllers and Views:
First, write your Models (which work as repository or DAL):
public class Person:WLBaseModel {
[PrimaryKey]
public int PersonID;
[stringLength (max:50)]
[REQUIRED]
public string name {get ; set ; }
[REQUIRED]
[stringLength (max:50)]
public string FamilyName {get ; set ; }
}
public class ADDRESS:WLBaseModel {
[PrimaryKey]
public int addrssID {get ; set ;}
[ForeignKey(Person)]
public int PersonID {get ; set ;}
[REQUIRED]
[stringLength (max:50)]
public string City {get ; set ; }
[REQUIRED]
[stringLength (max:65535)]
public string Address {get ; set ; }
}
And then you have to declare your META MODELS as below:
public class MetaModel :WLBaseMetaModel
{
[ApplicationServerCache { timeOut:10}]
public Person Person{get ; set ;}
[ApplicationServerCache { timeOut:10}]
public Address Address {get ; set ;}
}
In Standard MVC 3.00, you cannot have access to both models. In MVC PLUS And Meta Models, you can have many models in one Meta Model.
Views
We only support RAZOR in MVC.NET 3.00, so, other view engines are not supported by now and we don’t think we will support them later.
You can use META MODELS you declared in your View as below:
@Html.WLControlFor(m=>m.Person.Name)
@Html.WLControlFor(m=>m.Person.FamilyName)
@Html.WLControlFor(m=>m.Address.City)
@Html.WLControlFor(m=>m.Address.Addrsss)
All Model members will be connected to each other: Grids, Trees, Editors, checkboxes, Combos, etc., I repeat this phrase that you have to separate concept of Models and Meta Models from each other.
Here, you can see what I mean in the upper lines:
As you see, Tree and Editors are connected to each other.
But how does it work? In brief, we have an architecture like this. It was a complex architecture but we did it once to have a safe way of development:
Later, I will introduce how hard it is to implement such a code in a heavy JavaScript and C# Library (mostly in architecture which was a hard to do).
Note that this is a huge and great architecture for WEB, maybe for the first time??? (I don’t know! Just maybe.) We did several new things to supply these abilities.
Batch Data Transfer
In standard MVC, data transfer can transfer a single record and you need to do much custom code for multiple records.
Hard for development in most cases you want to transfer several records to/from Server.
In MVC, you can send / receive multiple records at once and we can name it Batch Transfer. It is useful for most cases of development.
As an extra advantage in architecture, MVC Plus has a two side (server/client) cache in both client and server which will guarantee:
- You will receive a record or data only once.
- You will receive only required records which are needed to show them in the client.
You can set Model Behavior as Live.
Since data is changed in client and you change cursor position in client or modify client data, Client will send Update or Inserted or Deleted item to Server.
Address.LiveData = true;
You can set Model Behavior as Offline.
You can send batch records, for example 10 modified records to server at once.
Person.LiveData = false;
To handle batch or single records, you have triggers such as:
Beforeinsert
BeforeUpdate
BeforeSelect
BeforeDelete
BeforeChange
BeforeOtherCommands
And also you have:
Afterinsert
AfterUpdate
AfterSelect
AfterDelete
AfterChange
AfterOtherCommands
Master/Details
In MVC Plus, you can make Models available in Meta Models as Master detail, but don’t worry, no need to do much code - you just have to do it with few lines of code. You can connect two models as Master details as below:
Address.Master = Person;
or:
[AutoConnectModels("*")]
public class MetaModel {
… {Models …
}
No need for extra code.
Required data for automatic actions will be provided through attributes over model properties:
[PrimaryKey]
public int addrssID {get ; set ;}
[ForeignKey(Person)]
public int PersonID {get ; set ;}
Validation
Validations will show beside controls and client will show a message before sending them to the Application Server.
Validation is very similar to standard MVC, but you can have:
RowValidation
FieldValidation
This is not required to do RowValidation
most of the time, but you can also add it to client and server.
By default, most of the validations will be done automatically.
A sample code would be:
[Required]
[RangeOf(OnlyAlphabet)]
[MaxMinLength(5,50)]
public string Name {get ; set ;}
Or even:
[Required]
[Password(StrongPassord)]
[MaxMinLength(5,32)]
[EqualTo("confirmPassword"]
Public string Password {get ; set ; }
Also, the system will automatically validate type of model members in both client and server.
Validations will show beside controls and client will show a message before sending them to the Application Server. You can set a special shape for them easily but by default, we have four different ways of showing them:
- Before Post as Modal (DIV Modal not POPUP!)
- In left top corner as tooltip when you are typing them
- Custom Way
- In Left or Right space of Edit Control
Components
Each single control should have a FieldName
, which is similar to Model
’s Property
name in application server, these will be generated automatically by C# or J2EE components.
Just leave your control simply in view:
@Html.WLControlFor(m=>m.Address.Addrsss)
We have many components ready for this Framework:
Html.WLTextEditFor
Html.WLWebEditorFor
Html.WLDivEditFor
Html.WLDisplayfor
Html.WLTreefor
Html.WLCheckBoxFor
Html.WLComboBoxFor
Html.WLSpinEditFor
Html.WLAutoCompleteFor
Html.WLLookUpFor
Html.WLGridFor
And more than 109 other READY TO USE components.
In the pictures, you can see some pages are designed with this system. Note that these tabs are not IFRAMES
but they come from different sources and they are used from JAVASCRIPT SandBox Model, always you can run any JS Command from server side without refresh.
MVC PLUS 2.00 now support TREE MODELS which did not exist before:
Ryan Samiee
BCs and 16 years Professional Experience (since I had 14 years old I started working with companies as a professional developer) and 14 years experience in Component Development in Delphi and then WEB Components.