Next to the "DB layer" post in the previous article, let's talk about the business layer. This old topic is just a little bit of a chat, even if we dig three feet deep, it will look like that.
Well, let's say something serious. Its role is to enable (DB layer) Startup (UI Layer). Is it over? Well, it's over! The data portion retrieved from the DB is handed over to the DB layer for processing, and the data portion is displayed to the UI Layer for processing. The other portion can be handed over to the business layer. alas, it is actually quite tiring. I have to work for two jobs by myself, but I have to add a class for free. in addition, I often carry cursing. If there is a problem, I usually look for the business layer first. Who makes it invisible and invisible!
The business layer is divided into several layers, that is, the benevolent sees benevolence and the wise sees wisdom. don't drill down here. You can divide the business layer into five layers. It doesn't matter if it makes sense or is easy to use.
Let's just talk about its special points.CodeThat's all.
1. create a project file for different software development methods, such as webform and winform. Of course, there is also a base used as a public class library. -1. this is for future development of other types of software, such as the development of WPF, SL and so on.
Figure-1
2. in the base public class library, the class library is implemented by classes one by one according to the interface definition. inherit common interfaces in baseservice. which of the following are not commonly used methods? iloghelper item_loghelper = loghelper. createinstance (); so you can call it. -2
Figure 2
Figure-3
After baseserivce is written, the webform and winform methods can inherit it directly, and then expand its own class libraries.
3. in this "class library", there is a concept: "data domain ". in the previous management software, the minimum unit for development should be the page, where the minimum unit is the data domain, that is, the data domain is used by the page, or contains it.
A page may have multiple data domains. for example, a document page has a toolbar and a tab control (including five panels ). this page will have five data domains, each of which is responsible for loading one panel data. of course, data collection also requires data domains. the toolbar data is also obtained through the data field.
For another example, a list page, as shown in-4, includes a toolbar, a search bar (including two buttons), and a grid control.
Figure 4
Use the data domain method, as shown in-5. The project storage in the toolbar is also stored in the data domain method. You only need to input one parameter for calling. Other buttons, such as right-click menus.
How to describe the concept of "data domain? Or why should I use it? Simply put, we need to refine the page level to make it more flexible.
Figure 5
4. the baseentity class is the ancestor of the object class. all entity classes in this class library must inherit this class, which is nothing more than a common method. such as the reflection mode value and value assignment. -6. it inherits an Interface
Figure 6
5. Another interface is the interface ancestor of the pure business layer, as shown in-7. The most vulnerable part of the business layer is shown. What is the role of this interface? It is the real industry business in management software. This part can be separated from the software itself, and this part is very easy to change. Why? I. the customer's requirements for it are unclear. II. our customer needs are unclear. this is good. We don't know what's going on both sides. What's the consequence of one piece of work. let's see how the interface is used after definition? -8
Figure-7
Figure-8
ArticleNavigation
My toolset dB Layer
Business Layer of my toolset
My toolkit UI Layer base & winform + example
My tool set UI Layer Webform ( Including Webpanel & jqueryeasyui Complete code ) + Display Example
Code address
Http://u.115.com/file/e60sh8gj #
Navi.kernel.service.base.rar
Extraction code:E60sh8gj