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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:49:30+00:00 2026-06-14T06:49:30+00:00

I have been working on this for a week now and have posted a

  • 0

I have been working on this for a week now and have posted a number of questions in the ASP.Net forums but no one is getting back to me. Here is the breakdown. I have an MVC4 project that is layered with two class libraries, one for modeling data and the other for accessing data. In the DAL I have the following:

public class GinkysDb : DbContext
{
   public GinkysDb()
        : base("ginkys")
    {
        Debug.Write(Database.Connection.ConnectionString);
    }

    public DbSet<User> Users { get; set; }
    public DbSet<SearchLog> SearchLogs { get; set; }

    public class DbInitializer : DropCreateDatabaseIfModelChanges<GinkysDb>
    {
        protected override void Seed(GinkysDb context)
        {

        Guid g1 = Guid.NewGuid();
        Guid g2 = Guid.NewGuid();
        DateTime Date1 = DateTime.Now.AddDays(-160);
        DateTime Date2 = DateTime.Now.AddDays(-37);
        DateTime Date3 = DateTime.Now.AddDays(-16);
        DateTime Date4 = DateTime.Now.AddDays(-10);
        DateTime Date5 = DateTime.Now.AddDays(-60);
        DateTime Date6 = DateTime.Now.AddDays(-23);
            new List<User>
            {
                new User{Id=g1,UserName="jIgnatowski",FirstName="Jim",LastName="Ignatowski",EmailAddress="Jim@Ignatowski.com"},
                new User{Id=g2,UserName="esmtih",FirstName="Elliott",LastName="Smith",EmailAddress="elliott@smith.com"},
            }.ForEach(u => context.Users.Add(u));
            base.Seed(context);

            new List<SearchLog>
            {
                new SearchLog{Id=(Guid.NewGuid()),UserId=g1,ComapnyName="GT",Notes=""},
                new SearchLog{Id=(Guid.NewGuid()),UserId=g2,ComapnyName="MCA",Notes=""},
                new SearchLog{Id=(Guid.NewGuid()),UserId=g1,ComapnyName="RLL",Notes=""},
                new SearchLog{Id=(Guid.NewGuid()),UserId=g1,ComapnyName="PwC",Notes=""},
                new SearchLog{Id=(Guid.NewGuid()),UserId=g2,ComapnyName="PH",Notes=""},
                new SearchLog{Id=(Guid.NewGuid()),UserId=g1,ComapnyName="KPMG",Notes=""},
            }.ForEach(s => context.SearchLogs.Add(s));
            base.Seed(context);
        }
    }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        Database.SetInitializer(new DbInitializer());
        base.OnModelCreating(modelBuilder);
    }
}

I have the following App.Config:

<configuration>
  <connectionStrings>
    <add name="GinkysDb" connectionString="Data Source=.\SQLEXPRESS;initial catalog=ginkys;integrated security=true;App=EntityFramework;multipleactiveresultsets=True" providerName="System.Data.SqlClient" ></add>

  </connectionStrings>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

I have tried adding : base(“name=GinkysDb”) to force it to look for this connection string in the App.config but I just get the following error:

No connection string named ‘GinkysDb’ could be found in the application config file.

It’s clearly in the App.Config! I am so aggravated! I have set these types of projects up in the past using VS2010, MVC3 and EF4.2 (OR whatever version introduced code first). This is the first time I am using VS2012, EF5 and MVC4…

If I remove the name= part it works fine but uses the default connector to my local SQLEXPRESS DB. As a test to make sure I knew it was not using the App.Config, I replaced the connection string with a verified working connection string to my Web Hosting service and deleted all of the instances of the DB on my local SQLEXPRESS server. When i run the app, it creates the DB on the local SQL server! PLEASE HELP! I am begging you!

Thanks!
Tony

  • 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-14T06:49:31+00:00Added an answer on June 14, 2026 at 6:49 am

    By default all configuration is gotten from config file of starting project. So your App.config connection string was not searching and not found. You should place your connection string to web.config file of your starting project and it will be found.

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

Sidebar

Related Questions

I have been working with this stored procedure Sys.xp_readerrorlog for around a week now,
I have been working on this for a week now and have trouble executing
ok I have been working on this webpage for a week now and have
I have been working on this problem for 2 days now and it's an
I have been working on this for days but I don't get it so
I have been working on this problem for a while now. I am trying
I have been working on this for 24 hours now, trying to optimize it.
I have been working on this for some time now and just cant quite
I've not been working with EF until this week (v5) and now I'm making
I have been working on dijkstra's algorithm for the past one week one I

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.