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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:17:53+00:00 2026-05-25T06:17:53+00:00

Suppose I am creating a application using the sample Northwind database using asp.net mvc

  • 0

Suppose I am creating a application using the sample Northwind database using asp.net mvc 3 and entity framework database first approach. For that I am opening a new asp.net mvc 3 project and then adding a ado.net entity data model. I am generating it from the existing database as it is already created. After that I am using the ado.net DbContext generator to generate codes for me. These includes all the models and the DbContext file(in this case NorthwindContext).

Now the problem that I am facing is in reorganizing the code. All the models should be placed in the Model folder of the project. Even if i generate the codes in the Model folder the NorthwindContext class is also generated in it. That is under the NorthwindContext.tt file a NorthwindContext.cs is generated. This file should reamin in the DAL folder as I will use it for accessing the data. Now if i just drag an drop it into the DAL folder the code generation stops automatically(no code remains in the NorthwindContext.cs file). Any idea how i can resolve this problem?????

  • 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-25T06:17:54+00:00Added an answer on May 25, 2026 at 6:17 am

    There are a few hoops you need to jump through to get this setup.

    You should have two T4 templates generated, one for the model classes and one for the context. Move the T4 template for the model to your model assembly then open it in Visual Studio and update the file path back to the edmx in your data access assembly. Edit the context T4 in the data access assembly to emit a using statement for the model namespace. Finally add a reference to your model assembly in the data access assembly.

    Whenever you want to regen the classes right click in VS and select Run Custom Tool for both the Context and Model T4.

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

Sidebar

Related Questions

I'm developing a web application using ASP.NET MVC and I'm using Windsor Castle as
I've been following this guide from MSDN about Creating an ASP.NET MVC Areas Application
Suppose I am creating an Android application that's like an SMS app. The requirements
I wrote an application that is using beans for creating and storing books(titles,authors etc)
Using VB.net 4.0 I have a Winforms application that is loosely based on MVVM.
Suppose you are implementing a publication database and creating migrations to represent different publications.
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX
I am creating an application with Geo Proximity Search capability using PHP as server
I am creating a client server application using c sharp. The server is using
I am creating an application that will take a URL as input, retrieve the

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.