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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:48:58+00:00 2026-06-07T20:48:58+00:00

We are using two database in that i need to inherit this model or

  • 0

We are using two database in that i need to inherit this model or entity table alone. For this how to specify database name for particular class or entity table in entity-frame work. It is possible?

Database Name: "Test1"

public class User : BaseEntity
{        
    public string Email { get; set; }
    public string Password { get; set; }
}

now how to set this model as navigation property in another model. like,

Database Name: "Test2"

public class Test: BaseEntity
{
  public int UserId { get; set; }

  public virtual User User { get; set; }
}

public class BaseEntity
{
   public int Id { get; set; }
}
  • 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-07T20:49:00+00:00Added an answer on June 7, 2026 at 8:49 pm

    Entity Framework DbContext could handle one Database.
    Then you should have two DbContext‘s for your two Databases.


    Update :

    I advice you not to do that. in another words you your Database and your Model should be in harmony “I love this word :)”

    And anything beyond that I suppose it should be in Service class “Layer”.

    So in your example you suppose to have a UserService class the get your User and don’t do this logic in the Test class.

    One another thing to notice: If your model connected together like this way then you should have just one Database.

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

Sidebar

Related Questions

I have two tables in a legacy database that I need to map using
I am using a database that I need to access in all activities. So
Background I have a GridView that builds a table using an ObjectDataSource . This
The situation is this: a table that is used in a query (name it
I need to read data from an online database that's displayed using an aspx
I have a database file that is generated on a PC using Sqlite. This
I am using two web projects and both using same Database of MS SQL
Using oracle database. Here's how i think the SQLException happens... Say i have two
I'm trying to link two tables in the same database using a third. The
I am using JDBC to query a MySQL database for specific records from two

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.