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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:23:05+00:00 2026-06-15T21:23:05+00:00

I am developing a site with MVC 3 and Entity Framework 4.1. I am

  • 0

I am developing a site with MVC 3 and Entity Framework 4.1. I am new to MVC 3 Development with Entity Framework so was hoping for some help with some design decisions. My site only has approx 15 pages that a user can go to. Rather than have controllers for each page – I was going to just have one controller class – (but have models for each page). And in the controller class I will keep my methods for each page in regions so they are easy to expand up. So for example I was going to have a LogOn Method in my SiteController that has RedirectToAction Homepage – and the Hompage() Method will live in my SiteController in the HomePage region.

I already have a Database Designed from a colleague (there are approx 12 or so Tables in the DB) – I have been looking at how Entity Framework will create code from that – however would it be advised to keep this code in a DAL folder and still have my own models for each page? So for example – I have a FileName that will be saved in the Database. On my homepage I want to show that FileName – so is it good practice to have a string FileName on my Homepage Model and then in the HomePage() view method the model.FileName is set from db.context(get filename from db).

Would it be best then to instansiate all the db context at the instanstiation point of my SiteController or just instansiate them in the methods that require them? i.e – if Homepage View needs table 1 and table 2 then new them in the Hompage() method and if another view method needs data from or has to save data to table 3/4 then new them at start of that method?

  • 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-15T21:23:06+00:00Added an answer on June 15, 2026 at 9:23 pm
    1. Use the EF Power tools to reverse engineer your database, that will create the folder structure.
    2. KEEP the one controller per page. Unless those pages are part of a wizard type data entry scenario that really are part of the same process, separate them out into multiple controllers.
    3. Right click, add new controller – use the builtin scaffolding to generate your controller using an entity framework context (make sure you build your application after step 1 above, select your context class in the “Add Controller” dialog). It will generate the views and controller for you. Repeat this for each item you want data entry for.
    4. Your context will be instantiated as part of the controllers that are already created for you – you shouldn’t need to do anything else (including dispose -the generated code will dispose it for you as well since the controller is disposed)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Entity Framework 5 on ASP MVC 4 web site I'm developing. Because
I am developing an ASP.NET MVC 2 web site, targeted for .NET Framework 4.0,
I am a new Asp.net Mvc programmer and I am developing a web site
I'm developing a web site in ASP.NET MVC 2. At some point, I get
I'm developing a site in asp.net MVC that should generate invoices. After some reading
I am developing a multi-layered, using ASP.NET MVC 3 and Entity Framework. I have
I'm developing an ASP.Net MVC site and on it I list some bookings from
I am currently developing a site using ASP.NET MVC 3, I am using Nhibernate.
I am developing a site using asp.net MVC. I have used AJAX for paging,sorting
I'm developing a Web Site using ASP.NET MVC 3, Nowadays I need to encrypt

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.