thatstevedude
thatstevedude

Reputation: 195

Keyword not supported: 'name'

So I'm going through this tutorial that seems so simple but I can't seem to get it to work. http://msdn.microsoft.com/en-us/data/gg685489

This is the error I'm receiving when running my app: "Keyword not supported: 'name'."

Now I've looked at other posts similar to mine and it seemed like the connection string was the issue. So I looked closely at but can't see any real differences.

    <add name="BBCommercialSolutionsEntities" 
     connectionString="metadata=res://*/Models.BBCommercialSolutions.csdl|res://*/Models.BBCommercialSolutions.ssdl|res://*/Models.BBCommercialSolutions.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=MYSOURCENAME;initial catalog=MYDATABASENAME;multipleactiveresultsets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" />

In my CompanyController.cs class, I receive the error when using the .ToList().

    public ActionResult Index()
    {
        //return View();
        using (var db = new BBCommercialSolutionsEntities())
        {
            //return View(db.BBCSCompanies.ToList());
            var tbl = db.BBCSCompanies;

            var list = tbl.ToList();

            return View(tbl.ToList());
        }
    }

And "new BBCommercialSolutionsEntities()" goes to my auto-generated template

    public BBCommercialSolutionsEntities()
        : base("name=BBCommercialSolutionsEntities")
    {
    }

Any ideas, thoughts, explanations, rants would help.

Upvotes: 0

Views: 4982

Answers (1)

Digvijay
Digvijay

Reputation: 361

Just use BBCommercialSolutionsEntities

public BBCommercialSolutionsEntities() : base("BBCommercialSolutionsEntities")
{
}

Upvotes: 3

Related Questions