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

  • SEARCH
  • Home
  • 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 7184577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:13:50+00:00 2026-05-28T18:13:50+00:00

I tried to create one more new ASP.NET MVC application (with Entity Framework) and

  • 0

I tried to create one more new ASP.NET MVC application (with Entity Framework) and a little frustrated again.

For example, I have a database with the following tables:

Table Users:

CREATE TABLE [dbo].[Users](
 [ID] [int] IDENTITY(1,1) NOT NULL,
 [FirstName] [nvarchar](50) NOT NULL,
 [LastName] [nvarchar](50) NOT NULL,
 [Title] [nvarchar](max) NOT NULL,
 [Company] [nvarchar](50) NOT NULL,
 [Phone] [nvarchar](50) NULL,

[CompanyUrl] [nvarchar](max) NULL,
 [EmailPlainText] [bit] NULL,
 [ProfileImage] [nvarchar](max) NULL,
 [ProfileDescription] [nvarchar](max) NULL,
 [ProfileDocument] [nvarchar](max) NULL,
 [ProfileWebSite] [nvarchar](max) NULL,
 [Facebook] [nvarchar](max) NULL,
 [Linkedin] [nvarchar](max) NULL,
 [MySpace] [nvarchar](max) NULL,
 [Twitter] [nvarchar](max) NULL,
 CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED 



CREATE TABLE [dbo].[Services](
 [ServiceID] [int] IDENTITY(1,1) NOT NULL,
 [ServiceName] [nvarchar](250) NOT NULL,
 [ServiceOrder] [int] NOT NULL,
 CONSTRAINT [PK_Services] PRIMARY KEY CLUSTERED



CREATE TABLE [dbo].[UserServices](
 [UserID] [int] NOT NULL,
 [ServiceID] [int] NOT NULL,
 CONSTRAINT [PK_UserServices] PRIMARY KEY CLUSTERED



CREATE TABLE [dbo].[GeographicalAreas](
 [GeoAreaID] [int] IDENTITY(1,1) NOT NULL,
 [GeoAreaName] [nvarchar](250) NOT NULL,
 CONSTRAINT [PK_GeographicalAreas] PRIMARY KEY CLUSTERED



CREATE TABLE [dbo].[UserGeoAreas](
 [UserID] [int] NOT NULL,
 [GeoAreaID] [int] NOT NULL,
 CONSTRAINT [PK_UserGeoAreas] PRIMARY KEY CLUSTERED

so, how can we see, there is : one table for User info, 2 table-dictionaries (Services and GeographicalAreas) and 2 tables (UserServices and UserGeoAreas) for relationship many-to-many between User and table-dictionaries. Standard situation

Also we have 3 different pages :

  1. On the first page should be displayed :

FirstName, LastName, Title, Company, Services (linked to an user) and GeoAreas (linked to an user)

  1. On the second page:

FirstName, LastName, Title, Company, Facebook, Linkedin and Twitter

  1. On the third page only FirstName, LastName, ProfileImage and ProfileDocument

Also, on the filrst page should be validate attributes like “required” etc

so, how to realize it?

The first way:

Creating 3 different view-classes (3 different models) for each page, creating 3 different linq-requests (3 public methods in a class-repository), each method of controller (for each page) calls the appropriate method in class-repository

The second way:

Create one common view class (which includes all requires fields for 3 pages), one common method in a class-repository, which fills all fields, each method of controller calls the method of repository

The third way:

Creating 3 different view-classes (3 different models) for each page, one common class (which includes all requires fields for 3 pages), one method in a class-repository, which fills all fields, 3 converters to move data from the common class to the appropriate view-class.

  • 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-28T18:13:51+00:00Added an answer on May 28, 2026 at 6:13 pm

    When in doubt, go with the Single Responsibility Principle:

    In object-oriented programming, the single responsibility principle states that every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.

    Your option 1 would be the correct one. Every view should have its own distinct controller and its own distinct view model (ideally being retrieved by its own distinct call to a repository).

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

Sidebar

Related Questions

I'm new to asp.net, mvc3 and entity framework. I'm trying to develop a mvc3
Introduction I'm writing a web application (C#/ASP.NET MVC 3, .NET Framework 4, MS SQL
I tried to create this by following the video at http://www.asp.net/learn/videos/video-7026.aspx where Joe Stagner
I'm trying to understand the Repository Pattern , while developing an ASP.NET MVC application
I have one ASP.NET web application running at the web server root which provides
I tryed to create new components from one base Windows Form, also I found
I am very, very new to MYSQL.I tried to create a table named option.
So this code runs in an asp.net app on Linux. The code calls one
I have a ASP.NET application running on Windows 2003 that needs to communicate with
I have an ASP.NET application with a lot of dynamic content. The content is

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.