[PaPaPa] MVC5 project integrating mainstream B/S Technologies, papapamvc5

Source: Internet
Author: User

[PaPaPa] MVC5 project integrating mainstream B/S Technologies, papapamvc5

Who are we?

We are a C # enthusiast, sharing technologies with each other, learning and growing together to build a project.

We are open-source enthusiasts, and all the code from our hands will be hosted on the source code management platform (oschina), so far there is no charge, and there will be no charges in the future.

We are big cows, and all kinds of problems encountered during work and study are discussed in the group. Maybe XX is just a junior programmer, but maybe you don't know it, at this time, he is your "Daniel ".

 

What are we doing?

A project called PaPaPa is similar to the B/s architecture project of companion games.

ASP. Net MVC5, Bootstrap 3, Metronic, Redis, EF, and SignalR used in the project.

 

System Architecture Overview

This is a PPT, and almost all content is here. After all, we have only done this for the time being. It will certainly be more than this in the future.

If you want to see the full PPT, You can stamp me: http://files.cnblogs.com/files/doddgu/PaPaPa.pptx

 

I found the PPT template on the Internet and changed it as needed. don't worry too much about hierarchical relationships.

 

 

This is the approximate classification of class libraries.

 

We tried to create something ourselves.

 

Add a solution

 

What have we done?

The prototype of the system architecture has been set up, and all the things mentioned in the above PPT have been completed (of course, some of them are still in the prototype phase, which requires a process of continuous improvement ).

At present, the project is in its initial stage and only has completed registration, logon, and user center (modifying user information ).

The infrastructure layer is completely isolated from the business and aims to build a reusable underlying class library. It features stability, scalability, and ease of use.

The core layer provides some compromise encapsulation for the business. This may not be so suitable for different businesses, but it is not completely without authentication. For example, cache decision making is a useful function in most projects.

 

It cannot be too watery.

In fact, the technology cannot be too true. It sounds very high that the word is actually a very simple set of method calls.

After all, this article is just a preface, and I won't write too much. If you are interested, continue to follow my next article. Here is a short piece of code that compares core points.

 

 1         public override async Task<int> SaveAsync() 2         { 3             var result = await base.SaveAsync(); 4  5             SetRedis(); 6  7             return result; 8         } 9 10         private void SetRedis()11         {12             try13             {14                 var type = typeof(T);15                 var monitor = EqualsMonitorManager<string, RedisCacheMonitor>.Get(MonitorConstant.REDIS_KEY, x => x.TableName == type.Name);16                 if (monitor != null)17                 {18                     foreach (var entity in base.DbSet.Local)19                     {20                         foreach (var field in monitor.Fields)21                         {22                             var pi = type.GetProperty(field);23                             RedisSingleton.GetInstance.Client.HSet(type.Name, string.Format("{0}:{1}", pi.Name, pi.GetValue(entity, null).ToString()), entity);24                         }25                     }26                 }27             }28             catch (Exception ex)29             {30                 Logger.Error(ex.ToString());31             }32         }

 

This code is actually a part of the upper half of the cache decision. before calling the cache, you need to fill in the cache data. Here, we will insert, modify, and delete the data (in fact, it is not deleted, because I can only change it to an invalid state and cannot delete data at the time of design.) The three actions that will cause database modification will be synchronized to redis.

There is a very big term. You can call it an "image" or "XXX". It's just a name for some big guys.

 

SaveChangesAsync is the asynchronous save method of EF. What we need to do is simply intercept the Save method. In the code, it is SaveAsync. This is our own encapsulated Method for EF.

 

The general idea is as follows:

Override will be used to rewrite SaveAsync if we want SaveAsync to listen to us.

After the basic class SaveAsync is called, add the code that is saved to Redis.

In this way, SaveAsync is used to do two things. It is saved to the database and then saved to Redis, so as to prevent repeated code stored in Redis from being written everywhere in the code.

 

Careful friends will find that we will not save all the data to Redis, so we must have a rule to tell us which data needs to be saved to redis.

In the code, mongomonitormanager is used to save the rule, because it needs to be used together with many things, so if you are interested in it, please wait for the blog below.

Of course, if you are an acute user, you can also directly download our code and track and debug the crash instantly.

 

Thanks

Finally, I would like to thank so many people for their contributions during the project launch process.

Tiger: A very good PM character. The requirement documents are funny and practical. In fact, I think it is better to call him "color Tiger.

Bay: never abandon any kind of work, learn and do it, good guy. You can also call him "100,000 reasons ".

Elder brother 4: If nothing happens, we will jump out and pick up the thorns and raise comments. In this process, we have indeed gained a lot.

Zero point: there are always various problems and an active group atmosphere.

The ellipsis (...) appears.

 

At this time, I have to say that I have learned something wrong.

Yes, I found that many of my previous open-source projects have been viewed, downloaded, and even added to groups, but few people have made recommendations and comments.

One day I noticed that a blog adopts a very good method, and I just followed suit.

 

If you want to get the Code address, you have to click here for recommendations, and then comment on your QQ mailbox, or read my introduction in the upper right corner. joining our group is also a shortcut.

If you add a group, you do not need to leave a QQ mailbox. The Group announcement contains a git address.

I wish you a pleasant job and everything goes well.

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.