Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the general attachment management module in the Winform development framework

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail what the general attachment management module in the Winform development framework is, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

When working on Winform projects, there has always been a dream that all the component modules can be assembled into a complete project system (or at least most of it). Even if it is a dream, I have been fighting for it, and with every step forward, we are one step closer to the dream. Therefore, in line with this dream, I have developed and organized a series of component modules along the way, including the underlying common class library, Winform paging control, general query components adapted to multiple databases, and relatively high-level component modules: general rights management system, general dictionary management module, general program automatic update module, general attachment management module. Of course, there will be more component modules that will attract me to continue to move towards my dream. In addition to these, in order to improve the efficiency of development, from the designed database, directly generate project code, from 2005 to now, has been improving my automatic code generation tool Database2Sharp. The attached picture below is that I am moving towards my dream for the current Winform development framework and future development plans, and record my progress and feelings with the blog park.

This piece of essay, or take root, continue to introduce my Winform development framework in a link, the general attachment management module. This module is actually a very general module, for example, some of our daily records may be accompanied by attachment management with pictures, documents, etc., if you do an attachment management for each business object, or every time the development system is redone, then the efficiency is certainly not as convenient and fast as using general attachment management directly. And in the increasing number of project management, we do not need to maintain a lot of the same or similar code, and my components are built-in to support multiple databases, and different databases only need to be properly configured for normal use. For component-based basic platforms and support for multiple databases, especially in project management, there are controversial and legendary gardeners. Jiri Gala has a very good explanation in the article "sharing from taking the lead in developing software projects to managing Shanghai's software projects well by remote control without going to the scene." in fact, his summary is very real. having a very good basic class (self-built or purchased) is better than starting all over again, and the technical industry has specialization, which is the embodiment of accumulated accumulation.

1. Multi-database support module

My consistent practice is that all modules, in order to meet unknown project requirements, are made into multi-database support, although it seems a bit troublesome, but because of the framework I refined, database access classes are highly abstract and well encapsulated, so even if you add a variety of database support, there is very little need to adjust.

For the support of the above databases, generally speaking, different database types of BaseDAL need to be added. Because each different database needs to have a BaseDAL, then many of the same operation codes will be redundant, because the basic operations of most databases are the same, only some of them are special and need to be personalized, so optimize the design of the data access layer and get the following design diagram. As shown below.

After the framework abstraction, this BaseDAL class code is very little, basically general database operations, has been put into the AbStractBaseDAL super base class for encapsulation, even for some different database operations, we also try our best to abstract to the above base class, BaseDAL only needs to implement some special operations.

2. Module control and * * reduce development work.

In order to reduce repetitive development, the control is required to consider the actual requirements scenario as much as possible. Generally speaking, we have two requirements in the data editing interface, one is to manage the attachment list corresponding to the data records, and the other is to maintain our own attachment information. These two requirements are described and explained below.

1) manage the list of attachments corresponding to data records

First, let's create a separate control to put into the edit data record window, as shown below.

In this way, integrate in the project (such as the data editing window), drag the control directly into the interface, and run to see the following effect.

Generally, when creating a record, assign him an attachment group ID of GUID, so that before the data record is saved, we can upload the attachment, as shown below.

And in the process, you can check the attachments you have uploaded in the record at any time.

If the attachment is not enough, you can start the upload operation at any time, and the attachment supports multiple files, and then start the background thread operation at one time to save the file upload and attachment records to the database, as shown below.

2) maintain your own attachment information

Sometimes, we need to manage our own personal attachments, and we also need to know which attachments we have uploaded in the business module. These are two common scenarios, so we develop an interface to manage and view these two types of attachments. Most of the requirements can be met, as shown below.

Because there may be more personal attachments or business accessories, or even the number may increase with the growth of the business, then paging is necessary. For example, the distribution of the picture above is based on my paging control module (pure paging control module, no list). This collection of paging controls is a control that my blog has introduced a lot, and this is one of the pure paging controls. It can be applied to all paging scenarios, not just to display two-dimensional tables. Of course, this pure paging control is also easy to use and can be used in a variety of situations where paging display is needed. This ListView is one of them, and can also be used in more scenarios such as picture display.

3. Integrated picture view control

Because it is an attachment management, it is possible to upload all kinds of files, including Word documents, Excel documents, compressed files, and various types of pictures. In order to facilitate the viewing of pictures, this control integrates a picture view control, which is very convenient to directly read the data stream of picture attachments and display them as objects. The picture control supports scrolling in and out of the picture, flip left and right, select to enlarge, move the picture, save the picture and other functions, do not need to view, directly use ESC to exit.

Of course, for other format attachments that are not pictures, because you do not know or it is difficult to view them directly, you can be prompted to save them locally and then open them for viewing, as shown below.

4. Integrate into WCF development framework

In order to reflect the consistency of the system interface and the completeness of the application, I have also developed an attachment upload module suitable for the WCF development framework, which can be used in more development situations, and it is more convenient to maintain the code because of the centralization of the attachment management module.

In fact, attachment management under the WCF development framework mode is more meaningful, because if it is pure local file management, it may not reflect the advantages of networked attachment management, so through the architecture of WCF, all attachment data can be accessed in different places and different network environments, and the distributed advantage is more obvious, which is also the same advantage of WCF development framework.

The above is my packaging of the attachment management module. I hope to move towards the ideal of WInform business module componentization and high customization of the final product, and build the final product as quickly as possible, with a highly stable and unified component interface or customer trust and praise.

Furthermore, for enterprises developing business systems, my modular Winform development framework even requires only individuals to master the maintenance and update of component code, so that more developers can devote themselves to the actual business development or control use camp, which can not only effectively protect the security and unity of products, but also develop a new system more efficiently. Without the need for any basic modules of the enterprise, developers are needed to re-create a bunch of basic products that are difficult to unify. A sentence at the beginning of the response is that the technical industry has specialization, but also reflects the accumulation of accumulated strength.

On the Winform development framework of the general attachment management module is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report