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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:58:41+00:00 2026-06-17T19:58:41+00:00

I’ve got a scenario with two different applications sharing the same database. For both

  • 0

I’ve got a scenario with two different applications sharing the same database. For both applications, I’m using Code First EF 4.1. Both of these applications share a common library as well. Everything is fine until I start adding application specific inheritance. For example, say I have a class in the shared library like this

public class Customer
{
    public CustomerOrder Order;
}

And then, in one application, I inherit CustomerOrder to add some custom functionality required for the application.

public class EditableCustomerOrder: CustomerOrder
{
    public void Edit() {};
}

In this application, I want all of my CustomerOrders to load as EditableCustomerOrders. However, I cannot find a way to specify in the mapping that it should ignore CustomerOrder and only map EditableCustomerOrder to the underlying table.

I tried this

modelBuilder.Ignore<CustomerOrder>();

but that omits the Order property from Customer, so I cannot use it. The only way I’ve gotten this to work is by using generics, so that Customer uses a generic for it’s CustomerOrder type, and then I implement Customer in the application to specify that it uses EditableCustomerOrder. However this solution can grow out of hand pretty quickly, with generics all over the place.

Is what I’m trying to do possible? Basically I’m trying to tell entity that, even though there is a base type and an extended type, I want it to only use the extended type.

  • 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-17T19:58:43+00:00Added an answer on June 17, 2026 at 7:58 pm

    In case any desperate beings stumble across this, I figured I’d post the solution I ended up with.

    The only way I found to make a scenario like this work was to use abstract classes as my base class that was defined in the shared library, and then extend that base class in each application. From that, I could write a DbContext for each application that ignored all added properties on the extended classes. With all of that in place, I am able to use Entity to map to different implementations in different applications to the same set of base classes.

    I would also like to advise against this overall idea as a solution. I’ve had this in place for several months now. It works, but it’s awkward to work with and mistake prone. To move away from this, I’m going to seal my model classes and instead focus on an MVVM solution for each application.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I've tracked down a weird MySQL problem to the two different ways I was
I'm making a simple page using Google Maps API 3. My first. One marker
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am using JSon response to parse title,date content and thumbnail images and place
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.