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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:51:27+00:00 2026-06-08T10:51:27+00:00

Several of our apps use multiple databases from the example below – each in

  • 0

Several of our apps use multiple databases from the example below – each in their own separate DBML file. The problem is, MVC by convention puts them all in namespace AppName.Models causing class name conflicts.

Which of the two options is the better fix and why:

1.) Putting them in separate namespaces. To keep stylecop/resharper happy, they would go in their own subfolder:

  • /Models
    • /Live
      • Live.dbml
      • LiveDataContext.cs
    • /Crm
      • Crm.dbml
      • CrmDataContext.cs

**but now in code, all uses of them have to be Live.Customer and Crm.Customer to differentiate between objects.

EDIT: The other main downside of this, is that I see no other sample code from experts that use sub folders in the Models folder. On top of that, in order to keep the same naming for Helper file code reuse – even apps that only use one database would need a subfolder in Models, which I certainly never see people doing in MVC

2.) Prepending all object names in one or both DBML designers with a prefix. This is my current approach. The Live database has Customer and Order objects, while the Crm database has CrmCustomer and CrmOrder. They all stay in the same namespace and /Models folder. This, however has two main drawbacks:

  • Quite a bit of prefix redundancy in accessing child objects: CrmCustomer.CrmOrders.First().CrmOrderType Marsha Marsha Marsha
  • In other apps which only use one database, we often omit the prefix – and then during code reuse or Helper files we have to do a lot of find/replace. This is particularly evident in Helper files that get added to every app like error/activity logging.

So I’d like to hear from other experts which of the two strategies they use, or something else entirely. It seems like a pretty common occurrence to have at least some name conflicts between databases. Thanks


Example table names:

Live Database:

  • Customer
  • Order
  • Address
  • Phone
  • Log
  • 20 other tables

Intranet Database:

  • Customer
  • Order
  • Address
  • Phone
  • Log
  • 20 other tables

CRM Tool Database:

  • Customer
  • Order
  • Address
  • Phone
  • Log
  • 400 other tables
  • 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-08T10:51:28+00:00Added an answer on June 8, 2026 at 10:51 am

    So, I question the design that leads you to needing two identical databases in code. That aside, I think option 1 is better. Here is my reasoning:

    1. The code is more reusable. If you ever need to seperate either model into another project, or remove one, you don’t have to remove the prefixes anywhere. This offers clean separation.
    2. Option 2 requires you to specify as well, you aren’t avoiding this. However, if any class needs to access only one namespace, you only need to specify at the using level, and not in every single reference to the code. In classes that need both, you aren’t avoiding the prefixses in either case. So option #1 wins out in the only case that matters.
    3. I generally avoid type-prefixes as a rule. They are ugly.
    4. Grumble, grumble, database design
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of our apps, we read in data from a file and expand
I'll be embarking on converting one of our old, legacy apps from VB6 to
We have several Silverlight 4 apps running using WCF Data Services on our website.
My company develops several types of applications. A lot of our business comes from
For several of our applications we use an application configuration file. It usually just
Our sysadmin renamed several of our AD groups that we are using in SQL
We're approaching a point of replacing several of our developer PCs and would like
I'm currently successfully reading out several properties on our switches over SNMP with php.
I have an Intranet http application running on several machines in our Windows domain;
At the moment I'm stuck with the need to debug several functions in our

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.