Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (17)--Thinking 2

Source: Internet
Author: User
Tags md5 mysql code

Write in front

Come back for dinner today, suddenly have a better idea, here to do a record.

Series Articles

[Ef]vs15+ef6+mysql Code First mode

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (1)

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (2)--User Registration

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (3)--Verification code

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (4)--Upload Avatar

[Bootstrap]modal Popup box

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--login interface, avatar and other proportional compression

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--page template

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--ajax mode registration

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (6)--ajax mode login

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (7)--File upload

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (8)--File download, delete

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (9)--Edit file name

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (10)--New Folder

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (11)--New Folder 2

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (12)--new folder and upload file

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (13)--Edit folder

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (14)--Logical reconstruction

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (14)--thinking

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (15)--Logical refactoring 2

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (16)--Logical refactoring 3

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (17)--Thinking 2

Ideas

Usually if you want to get the files on the computer, most will use a recursive way, so think of such a table structure.

The ID is the self-id,pid of the file or folder, which is the ID of the folder in which the file or folder resides, that is, the parent ID. The benefit of designing a data table is to upload files, create folders, modify folders, and simply consider the current object, without having to think about the path. Modify the name to do just modify the name of the line, no longer consider modifying the folder name to find the file is not the problem.

So the MyFile class is as follows:

   /// <summary>    ///My file information/// </summary>     Public classMyFile {[Key] Public intId {Set;Get; } /// <summary>        ///         /// </summary>[Display (Name ="name")] [Stringlength (1024x768)]         Public stringName {Set;Get; } /// <summary>        ///Extended Name/// </summary>[Display (Name ="file name extension")] [Stringlength (8)]         Public stringFileext {Set;Get; } /// <summary>        ///file or folder icon/// </summary>[Display (Name ="file icon")] [Stringlength ( +)]         Public stringFileicon {Set;Get; } /// <summary>        ///File Size/// </summary>[Display (Name ="File Size")]         Public intFileSize {Set;Get; } /// <summary>        ///file MD5/// </summary>[Display (Name ="file MD5")] [Stringlength ( +)]         Public stringFILEMD5 {Set;Get; } /// <summary>        ///File modification Time/// </summary>[Display (Name ="File modification Time")]         PublicDateTime Modifydt {Set;Get; } /// <summary>        ///File Upload Time/// </summary>[Display (Name ="File Upload Time")]         PublicDateTime Createdt {Set;Get; } /// <summary>        ///whether to delete tombstone/// </summary>[Display (Name ="whether the file is deleted")]         Public BOOLIsdelete {Set;Get; } /// <summary>        ///Owning User/// </summary>[Display (Name ="file belongs to")]         Public VirtualUserInfo User {Set;Get; } /// <summary>        ///whether it is a folder/// </summary>         Public BOOLIsfolder {Get;Set; } /// <summary>        ///Parent ID/// </summary>         Public intParentID {Set;Get; } }
Summarize

This kind of operation is more convenient, the front section passes the parameter, only then must pass the current object's id,pid to the service side to be OK. Modifying a folder is easier. The problem that arises today is that at the beginning of the project, it was not considered too deep, it was to think about where to write where, not from the whole to think of details. Cause now, it's time to go.

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (17)--Thinking 2

Related Article

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.