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 3798800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:37:52+00:00 2026-05-19T13:37:52+00:00

I am writing a project in MVC and am using EF 4.0. I am

  • 0

I am writing a project in MVC and am using EF 4.0. I am using the repository pattern but am unsure about where to place some properties.

public interface IUserRepository<User> 
{
    User GetUserById(int userId);
    void UpdateUser(User user);
    void AddUser(User user);
    List<User> GetUsersByName(string userName);             
    void Create(User user);      
    int NumberOfFollowers { get; set; }     
}

My two problems are 1). should the property NumberOfFollowers be a property or a method?
and 2). should it be placed inside the User entity class instead of the interface?

cheers.

  • 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-05-19T13:37:53+00:00Added an answer on May 19, 2026 at 1:37 pm

    If NumberOfFollowers is a property of a User, it should definitely be on the User class, not the repository. The repository is responsible for getting/putting data only.

    Here is my favorite repository implementation for EF:

    http://www.codeproject.com/KB/database/ImplRepositoryPatternEF.aspx

    This one is terrific, very complete and comes with a lot of features.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an online project asset tracker but I'm new to MySQL. What would
I'm using asp.NET MVC 2 for my current project and I need to validate
I'm currently using jqGrid and ASP.Net MVC. With my current project, my goal is
I'm writing a project in mvc 3. I want to set an object in
I'm relatively new to PHP and have been writing a project using what I
We're currently using GWT RPC for serialization on a GWT project but we're currently
I am using linq to sql for my mvc 3 project. There are several
Coders, I am in process of writing test cases for Asp.net MVC 3 project
I'm currently writing a project in ASP.NET MVC. I have a web project and
I've been working on an ASP.NET MVC project for about 8 months now. For

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.