SubSonic 生成列为 ColumnX 的表
这对我来说没有多大意义。最近,在为数据库表生成 SubSonic 对象或视图列重命名为 ColumnX 时,发生了两次这种情况。第一次它有意义,因为列名是 Value,一个 C# 关键字。但第二次发生时,表的列名是 Grade,它不是关键字或保留字。有谁知道为什么SubSonic在生成对象时将这个列名变成GradeX?
谢谢。
This doesn't make much sense to me. We had this happen twice recently when generating SubSonic objects for a database table or view columns got renamed to ColumnX. The first time it made sense because the column name is Value, a C# keyword. But the second time it happened, the table's column name is Grade, which is not a keyword or reserved word. Does anyone know why SubSonic turns this column name into GradeX when it generates objects?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您所假设的,它是为了替换单词,这样它们就不会与 .Net 或 SQL 类型冲突。不要忘记 SubSonic 与各种数据库提供商进行对话,因此虽然“Grade”不是 MSSQL 类型,但它可能是 Oracle 或 MySQL 等...
在 SubSonic.Utilities.Utility 下有一个名为 KeyWordCheck 的方法,它执行附加操作。
也许您可以编译自己的版本并修改此方法以排除“Grade”:
It is, like you assumed, to replace words so they don't conflict with .Net or SQL types. Don't forget SubSonic talks to various db providers so although "Grade" isn't a MSSQL type it's possible it's an Oracle or MySQL etc...
Under SubSonic.Utilities.Utility is a method named KeyWordCheck which does the appending.
Perhaps you can compile your own version and amend this method to exclude "Grade":