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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:18:12+00:00 2026-05-23T13:18:12+00:00

I need a valid SQL Server 2008 connection string for Entity Framework 4.1 code-first

  • 0

I need a valid SQL Server 2008 connection string for Entity Framework 4.1 code-first project. I would use it now with MVC 3.

For now it’s still very simple, only 1 project, 3 simple model class…

I could only find everything else, like Sql Express, CE connections on the web…

Finding it by name in web.config (“ApplicationServices”) is OK, because when I tried to use I got specific errors for that.

The best I could get is:

Unable to load the specified metadata
resource.

I tried to give it like metadata=res://MyWebProject/MyWebProject.csdl| ... also but no success.

So it doesn’t create the database for me – even doesn’t hit the OnModelCreating(DbModelBuilder modelBuilder) method.

If I try to use an ‘old fashioned’ connection like the ones I found for SQL Server Express, it misses the metadata.

Thanks for your help in advance.

  • 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-23T13:18:13+00:00Added an answer on May 23, 2026 at 1:18 pm

    The idea of “Code-First” is, that you shouldn’t have to deal with the .csdl, .ssdl and .msl files mentioned in the connection-string. If not specified elsewhere, the DbContext will lookup the connection-string in the web.config as you described. The constructor of the DbContext class will accept a name-value pair specifiying the name of the connection-string in the web.config. For example:

    <connectionStrings>
        <add name="ConnectionName" 
             providerName="System.Data.SqlClient"
             connectionString="Server=ServerName;Database=DatabaseName;Integrated Security=True;" />
    </connectionStrings>
    

    can be referenced in your context:

    class MyContext : DbContext
    {
         public MyContext() : base("name=ConnectionName") { }
         ...
    }
    

    The sample connection-string I’ve provided is actually for a SQL Server database. It is important to specify the ProviderName, since the “Code-First” requires it to generate a corresponding .ssdl-File (storage schema).

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

Sidebar

Related Questions

I need to run a stored procedure on SQL Server, using LINQ, and throw
I have a SQL Server running on my Windows Server and, at a specific
I have two listbox in windows Form c#, the first one has all valid
An error occurred at line: 9 in the jsp file: /Test1.jsp The method addURL(String,
I'm still new to SQL (Oracle).. Basically on a table I'm selecting from, there
I would like to get opinion on the best way to manage the following
I am trying to create a SqlUserDefinedAggregate in C# to attach to my SQL
I need to find out how many rows in a particular field in my
I need to install a certificate for encryption (replication) between an external vendor and
I have a DataGridView with a combobox column in it, showing the possible prices,

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.