Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8713849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:26:47+00:00 2026-06-13T05:26:47+00:00

In a web application using Entity Framework 4.1 we use SQL Server Membership to

  • 0

In a web application using Entity Framework 4.1 we use SQL Server Membership to manage user access. However we need to implement a more granular set of roles a permission management.

In the database we have already created the relative tables:

- Roles 
- Permissions 
- UserInRole (roles per user)
- RolesPermissions (permissions associated to a role) 

Using attributes on some of the core entities we restrict the access semantically with EF, as example, given a specific user, s/he can see only the relative shipped orders or inherent data.

Now we would like to inject the permissions in it, meaning as example that a customer can see and create orders, while a company (these are two different roles) could only see orders for their products and also print reports.

The idea would be to use attributes also for permissions at entity level and check if the current user owns proper rights when a method is invoked. For instance:

public void BeforeAdd()
{
   // Get required permissions for the specific entity (Order as example)

   //Check that current user has permission of creating a new Order 
}

Such a method would be called by each entity, allowing to centralize the control over permissions at entity level.

We use MVC as frontend and in there we have already implemented roles and permissions access. We need to make the same with the backend part (containing data layer). These are two separate servers communicating via web services. By implementing permission management on the back end part would strengthen the control over data access.

Is there any pattern or best practice that we could follow (eventually using some built in features of EF) to achieve permissions management?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:26:49+00:00Added an answer on June 13, 2026 at 5:26 am

    Is there any pattern or best practice that we could follow

    Yes, it’s called Aspect-Oriented Programming and PostSharp is probably the best tool for the job (unfortunately it’s not free).

    However, if you are using MVC (you haven’t mentioned anything as such yet) you could derive your own version of the AuthorizeAttribute to query your own permission tables and you can simply decorate your actions with the roles you want to allow e.g.

    [Authorize(Roles="Customer, Company")]
    public ActionResult ViewOrders(...)
    {
        ...
    }
    
    [Authorize(Roles="Customer")]
    public ActionResult CreateOrder(...)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the Entity Framework in a web application that utilizes SQL server
I am developing an ASP.Net MVC 3 Web application using Entity Framework 4.1, however,
I have a web application that is using Entity Framework to query a SQL
I am developing an ASP.Net MVC 3 Web application using Entity Framework 4.1 and
I am writing an ASP.Net MVC 3 Web Application using Entity Framework 4.1. My
I've created a web application project in Visual Studio 2010 using Entity Framework Code
I have just create a very basic Dynamic Data web application using Entity Framework,
I use Asp.net 4 in C# and Entity Framework 4. My web application is
I have a ASP.NET MVC 2.0 application using Entity Framework. All my views use
I'm using the Entity Framework for an ASP.NET Web Forms application and I'm wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.