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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:51:16+00:00 2026-05-25T16:51:16+00:00

When I add stored procedures to a linq datacontext, by default visual studio prefixes

  • 0

When I add stored procedures to a linq datacontext, by default visual studio prefixes the stored procedure with the sql schema that it is in. Is there any way to stop this? In our environment, the stored procedures may be moved to other schemas over time, and we will default the schema based on the sql user used to connect. Do I have to do this manually or can I somehow turn off the schema prefixes?

  • 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-25T16:51:17+00:00Added an answer on May 25, 2026 at 4:51 pm

    There doesn’t appear to be any means of removing the schema from LINQ-to-SQL mapped stored procedures using the designer. All procs are mapped including their schema name, which (to be fair) is probably a good thing for most applications. And as with most things LINQ-to-SQL, change your database at your own peril. Too many database changes required LINQ-to-SQL dbml updates & rebuilds.

    Digging deeper, the schema name is stored in the backing dbml XML file, and is then included in the generated designer.cs file which contains the functions / methods which are called.

    // dbml
    <Function Name="dbo.MyProc" Method="MyProc">
    
    // designer.cs
    [global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.MyProc")]
    public int MyProc()
    

    If you manually edit the dbml XML file to remove the schema & save within Visual Studio, the code will be regenerated like this:

    // changed dbml - removed the dbo schema
    <Function Name="MyProc" Method="MyProc">
    
    // the resultant generated code in designer.cs
    [global::System.Data.Linq.Mapping.FunctionAttribute()]
    public int MyProc()
    

    Which worked for my account, logging in with dbo as default schema. I’ll leave the testing up to you.

    This might be a workable solution – the visual designer still works like this, other items can be added etc without breaking the schema-less function, and the function itself doesn’t cause the designer to complain. Best of luck!

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

Sidebar

Related Questions

I'd like to add the msdb.dbo.sp_help_job system stored procedure to a LINQ to SQL
I am attempting add a tableadapter to a stored procedure in my SQL Server
I know there have been numerous questions here about inline sql vs stored procedures...
Normally, when you want to call a stored procedure directly through Linq to Sql,
I have a Orders_SPs.sql file. Its purpose is to add a new stored procedure
If you're creating a temporary table within a stored procedure and want to add
for example... ALTER PROCEDURE [dbo].[Reports_Dashboard_Get_Sav] -- Add the parameters for the stored procedure here
I have a method that calls a stored procedure. It uses the employee number
I want to add custom (compound and read-only) attributes to my stored procedure results
I have several Stored Procedures that when added to my dbml, it seems that

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.