. Net permission note-Attribute + reflect + remoting

Source: Internet
Author: User

Dudu'sArticleI was very excited when I found that application message interception could perform centralized permission verification.

It's a pity that all of you think about it. No one can think of such a great thing.

However, there is another headache for permission allocation.

I can see that someone uses enumeration and then uses a bit to differentiate the permission information. The advantage is that there is little space to avoid overlapping permissions.

Some people also use the enumeration of flags to quickly identify the permission set, which is very nice, but what makes me hesitate is that it can only identify 64 types of permissions. What should I do, it is impossible for other methods to achieve better performance than it (for example, if we use a set of things, I cannot pursue performance here. Imagine if more than half of our methods will use permission verification, so this improvement will be very meaningful ). There are always methods, and people cannot throw their urine.

Now the problem is that the permission for using flags for integer enumeration is very limited (even if it is more than one hundred long), flags can bring absolute performance advantages.

My idea: use multiple enumerations to enumerate different enumerations and use reflection to synchronize enumeration and database.

Next, try to paste the demo.

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.