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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:34:39+00:00 2026-05-22T02:34:39+00:00

In LINQ to SQL there is a very simple convention to tell the mapper

  • 0

In LINQ to SQL there is a very simple convention to tell the mapper what database schema to use – [Table(Name = "SchemaName.TableName")].

Is there something similar in EF CF 4.1? I would rather not use annotations in the entity classes to keep them as pure as possible. For the sake of keeping my project moving I’ll make the sacrifice though.

This question is close, but not exactly what I need. It may even be outdated as it looks like it’s referring to classes that have been renamed or have had breaking changes since the recent EF 4.1 release – Entity Framework 4: Code First – Creating db in another schema? MapSingleType?

EDIT: I should also mention that my application has three schemas at the moment, so I can’t necessarily use a solution that changes only the default schema from “dbo” to “otherschema”.

  • 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-22T02:34:40+00:00Added an answer on May 22, 2026 at 2:34 am

    The linked answer is old and it doesn’t work because custom conventions were removed from final version. If you want to change name of schema you can use fluent api:

    public class Context : DbContext
    {
        public DbSet<YourType> YourTypeSet { get; set; }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<YourType>().ToTable("TableName", "SchemaName");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will use LINQ-to-SQL when the database is ready and use the entities there
Is there a way to translate an expression to SQL to use with LINQ
I have a linq to sql database. Very simplified we have 3 tables, Projects
When using linq to sql are there any benefits of using subsonic's active record
Is there a way to duplicate a db record with linq to sql in
Are there are good in-memory transactional databases that support LINQ and SQL Server persistance?
Is there any open source software for converting SQL statements to LINQ?
I use LINQ-SQL as my DAL, I then have a project called DB which
I have a very complex Linq to SQL query that returns a result set
Microsoft has made saving objects very easy with their LINQ to SQL mapping. However,

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.