Discussion on the overall design of the privilege system based on SOA architecture using EXTJS display

Source: Internet
Author: User
Tags config constructor json reference

The previous article said that the system consists of data layer, business layer, service layer, Data Contract layer, WCF Agent layer, ExtJS Agent layer and presentation layer. Now let's explore the role of these layers together.

As we all know, the main three-tier structure consists of database, business layer and presentation layer. I think that the SOA architecture adds a service layer, a data contract layer, and a WCF agent layer on a three-tier basis.

Now let's explore the role of each layer together!

Data tier: The layer used to interact with the database. Provide concise and practical database access methods, such as: Add, delete, update, find and so on. I have the data layer here using LINQ technology, from LINQ automatically generate data access layer, save a lot of development time oh.

Business layer: Used to support business requirements, this layer is generally highly flexible, scalable, configurable and so on. In most cases, the relevant tools are provided to support business requirements. Such as: Configuration Manager. When designing this layer, consider reusing and saving the cost of the next development software. Personally, this is an important factor in measuring the level of software developers.

Service layer: This layer is essential under the SOA architecture. The role of the service layer is that the business provides external interfaces in the form of services. Make the business access to the platform, technology independent. It is very important to grasp the granularity of service. For example: The permission system contains users, user groups, permissions, modules, and their allocation of such operations. We believe that the size of the service should be how to grasp. Here I offer two personal ideas: 1. The entire authority system as a service; 2. Each function block of the privilege system becomes a service respectively. Such as: User Service, user group services. At present I am using the first way, if you have a better idea, hope to explore together oh.

Data Contract Layer: Service is inseparable from the contract, just like the story of fish and water. Because the contract is the way to publish the service. Without it, external services are not visible. Since they can not be separated, why not merge the data contract layer with the service layer, you are not a good beating Mandarin. I have to, because I want to let the implementation of the service code and the public interface to separate, so that we can make the implementation of the details of security, to protect the fish wow.

WCF Agent layer: This is used on the client, is also essential. It is generally generated automatically by adding a service reference.

ExtJS Agent Layer: Why should there be ExtJS agent layer? Because ExtJS will encounter many problems in direct interaction with WCF. such as: WCF and ExtJS through JSON serialization after the date format conflict, the tree JSON format (ExtJS tree has its own fixed format), WCF get ExtJS parameters, etc. Most crucially: I can't turn the service layer into a service that only supports ExtJS in order to use ExtJS, which is out of the essence of service. So I joined the ExtJS agent layer. Solve the problem of interaction between service and ExtJS.

ExtJS: How excited and joyful I was when I first saw ExtJS in 07. What a wonderful web interface there is in the world. It really excited me for days. At that time JS or rookie of me, on the basis of a share of stupidity peculiar ken down this piece of hard. Home talk about the end, the following point, we forgive Wow. The ExtJS presentation layer is a user experience that is directly influenced by the user's actions. Now some customers, has not only asked the software to meet the needs of the business, but also to be beautiful, easy to use, it is best to love at first sight wow. Some people say that ExtJS is very large, slow, difficult to maintain and other related shortcomings. Yes, I do not deny these views, ExtJS is not perfect, but it also solves a lot of problems. such as: Tree. The tree provided by ASP.net and the tree provided by ExtJS are not at all a level. Remember an article "for the tree, but also to learn ExtJS." I'm now assigning users, such as users, the ability to use drag-and-drop as a way to allocate, improve usability and user experience, and make Web applications WinForm. If you have an easier way to distribute, please do not hesitate to enlighten us. About ExtJS is huge, I think the asp.net is even bigger. Why not reject it? I think it is determined by the easy debugging, easy to write code and other factors. On the contrary JS, difficult to debug, write code and no decent smart tips. About the slow speed, more than 200 K of the file download, the first visit speed is indeed faster than where to go. So I recommend the ExtJS for background management, the front-end access to the large number of jquery can use these lightweight tools. But ExtJS put a lot of things on the client side, to a certain extent reduce the pressure on the server. On the difficulty of maintaining this shortcoming, I would also like to talk about personal views. If the JS code is well organized, maintenance is still possible. My current JS code uses a namespace and is implemented in a way that includes or inherits it. Such as: User interface. I first implement my own Editorgridpanel, and then user inherits from the Editorgridpanel user interface. If the user's user interface is required for the function assigned to the users, the user interface can be obtained directly by new user (). This scalability, maintainability, reusability is not improved. Here is a piece of code. Welcome everyone to make bricks wow ~ ~.

Editorgridpanel class/

<reference path= "~/extjs/adapter/ext/ext-base.js"/>
<reference path= "~/extjs/ext-all-debug.js"/>
/**
* Author: Hudausong
* email:fjfuqingxds@163.com
* createdate:2008-9-28
*/
Editorgridpanel class
// ================================
Creates a custom grid and inherits from Ext.grid.EditorGridPanel
Xds. Platform.Grid.EditorGridPanel = Ext.extend (Ext.grid.EditorGridPanel, {
Constructor:function (config) {
This.clickstoedit = 1;
This.autoscroll = true;
Ext.applyif (This, {
Store:new XDS. Platform.Data.Store ({
Url:xds. Platform.config.UrlUnion (This.url, XDS. Platform.config.SelectOperation),
Id:this.dataKey,
Fields:this.fields,
Grid:this,
Listeners: {
Beforeload:function () {
This.help = new XDS. Platform.help ();
This.help.beforeload (This.grid);
},
Load:function () {
This.help.completeload (This.grid);
}
}
})
});
Ext.applyif (This, {
Viewconfig: {
Forcefit:true,
Columnstext: ' column ',
Sortasctext: ' Ascending ',
Sortdesctext: ' Descending '
},
Bbar:new Ext.pagingtoolbar ({
PageSize:this.pageSize,
Store:this.store,
Displayinfo:true,
Displaymsg: ' Total records {0}-{1} of {2} ',
Emptymsg: "No Record"
})
});
if (Ext.isarray (this.operate)) {
Ext.applyif (this, {tbar:new XDS.) Platform.Grid.GridToolBar (This)});
}
Xds. Platform.Grid.EditorGridPanel.superclass.constructor.call (this, config);
},
Load:function () {
This.getstore (). Load ({params: {start:0, limit:this.pageSize}});
}
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.