无效令牌“事件”在课堂上...编译 SubSonic 项目时出错
我只是第一次玩弄亚音速 ORM。我正在使用 ActiveRecord 模板,
我已按照 subsonic 网站上的说明编辑了包含文件,并将 app.config 文件指向我的 MySql 数据库。
当我去编译类库时出现以下错误
类、结构或接口成员声明中的标记“事件”无效
我猜问题是由于我的一个表名为“事件”而 Subsonic 必须采用该名称,砍掉“S”并最终结束生成尝试创建名为“event”的类型的代码,这会产生问题,因为 event 是 C# 中的关键字。
我的说法正确吗?有没有一种方法可以解决这个问题而无需重命名数据库中的表?
编辑:
错误是在 context.cs 文件中的以下行中生成的
public Query<event> events { get; set; }
I'm just fooling around with the subsonic ORM for the first time. I'm using the ActiveRecord templates
I've edited the include files as per the instructions on the subsonic web site and pointed the app.config file to my MySql database.
When I go to compile the class library I get the following error
Invalid token 'event' in class, struct, or interface member declaration
I'm guessing the problem is due to the fact that one of my Tables is named "Events" and Subsonic must take that, chop off the "S" and end up generating code that trys to create a type named "event" which creates problems because event is a keyword in C#.
Am I right about this? And is there a way around it without renaming tables in my database?
EDIT:
The error is generated in the context.cs file on the following line
public Query<event> events { get; set; }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
Settings.ttinclude
文件的顶部。您可以使用 CleanUp 方法来修改表名称。
我不知道在“s”被切掉之前或之后是否会触发,但是您可以通过一种或另一种方式附加一个额外的“s”来强制类名是
events
而不是event
或者您甚至可以将表重命名为完全不同的名称
Look at the top of your
Settings.ttinclude
file.There is a CleanUp method that you can use to modify your table names.
I don't know if that fires, before or after the "s" get's chopped of but one or the other way you can append an additional "s" to force the class name to be
events
rather thanevent
or you can even rename the table to something totally different