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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:15:57+00:00 2026-05-31T04:15:57+00:00

Using ef4 code first you can create and compile classes and dbcontext. What happens

  • 0

Using ef4 code first you can create and compile classes and dbcontext. What happens when you want to add some classes/tables and relationships in an already compiled dll of a model set?

So far the solutions I have come up with are using “partial” classes, that would be complimented later on, and the second one is writing a whole new dbcontext that includes the first one in some way or extending it, but this would mean additional db connection per module (per db context). Any ideas about this? What’s the best practice ? Also I need to be able to work with migrations.

More explicitly, a possible scenario is as follows:

A) You create a .dll with some dbContextBase class and tables(classes) inside that.

B) You create other .dlls that depend/extend dbContextBase in their own way*

C) You refference said .dlls in a project and extend them.

So basically you can have a core dbContext, then add a menu module to it, then you add a blog module to it (but it can be seen by the Menu module in order to create latest blog posts menus etc). On top of that, if you want a specific one-time feature for blog you can quickly integrate that, but also keep your blog module updateable.

As I beggin to see it the best way to do that is Nuget packages with the source code for the models (and the like) per module, instead of compiled dll.

  • 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-31T04:15:58+00:00Added an answer on May 31, 2026 at 4:15 am

    Since there is no answer that focuses on the problem the way I put it, I am posting an answer with what seems to be the best workaround at this moment.

    For full support of migrations, even custom migrations, and full support in general for code-first design, the best method is to import the source codes and compile directly.

    We are using a local nuget feed in order to be able to sync multiple sub-modules freely and swiftly. This also leads to a good update experience since the migrations can easily be created or imported/integrated when needed

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

Sidebar

Related Questions

I am trying to do some tests using EF4 + CTP5 with code first
I'm using EF4.1 Code First. I can't get a very simple insert to save
I just created a new project in MVC3 using EF4 code first deployed on
I would like to know the pros and cons of using EF4 Code-First approach.
I've been using EF4 (not code-first) since a year, so I'm not really an
I'm using EF 4.2 (database-first) with the DBContext T4 templates to create my POCO
using MVC3, Code First (DbContext) Is there a way to implement (ideally) a facade
I'm using Ninject with an MVC app, also using EF4.1 Code First. I'm getting
I am using EF4 Code First (CTP5) to generate my database and I am
I'm using EF4.1 in code-first style to persist POCO objects for a small ASP.NET

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.