I have developed a new .Net application using Visual Studio on my local machine. I have created a Google Cloud SQL instance to hold the database. I am trying to establish a code-first Entity Framework database on the server, and am having issues connecting.
I am following Google's provided guide (terrible as it is), and am getting stuck when setting up the connection string in the Web.config file. The guide: https://cloud.google.com/dotnet/getting-started/using-cloud-sql
I have already added my IP to the accepted connections on the cloud SQL side. The ONLY changes I have made to the default Web.config file are:
1) Comment out existing connection string. 2) Replaced with:
<add name="CCGamesGCloud.EntityFramework.Context" connectionString="Data Source=tcp:###.###.##.###;Initial Catalog=CCG-GamesDB;User ID=####;Password=########"
providerName="System.Data.SqlClient" />
the above is using th correct IP and login information in place of ****, name is the location of the DB Context
Am I missing specific appSettings config key/values?
Attempting to look at the connection in the server explorer gives the following error. https://i.stack.imgur.com/rsvWU.jpg
Can someone point me in the right direction? I've been googling help blogs for the past hour, but google seems to love to give its own stupid guide as the top results for every search I make.
Context class:
public class Context : DbContext
{
public Context() : base("CCGamesGCloud.EntityFramework.Context")
{
}
public virtual DbSet<Developer> Developers { get; set; }
//... etc. etc... for all DBSets
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Developer>();
// other calls... etc here
}
}