关键字不支持:'name' [英] Keyword not supported: 'name'

查看:150
本文介绍了关键字不支持:'name'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我要经历这个教程,看起来很简单,但我似乎无法让它工作。
http://msdn.microsoft.com/en-us/data/gg685489

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

这是运行我的应用程序时收到的错误:关键字不支持:'name'。

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" />

在我的CompanyController.cs类中,使用.ToList()时收到错误。 p>

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());
        }
    }

和新的BBCommercialSolutionsEntities()转到我的自动生成的模板

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

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

任何想法,想法,解释,咆哮都有帮助。

Any ideas, thoughts, explanations, rants would help.

推荐答案

只需使用BBCommercialSolutionsEntities

Just use BBCommercialSolutionsEntities

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

这篇关于关键字不支持:'name'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆