需要帮助重新创建 Subsonic 2.2 / SubCommander 生成的表和列名称
我正在编写一些代码生成模板,这些模板将与 SubSonic 2.2 / SubCommander 生成的类/程序集协同工作。我遇到的问题是 SubSonic 正在使用一些美丽的魔法来规范化表和列名称,对它们进行单一化,提取无关字符等。
我生成的类(必须)直接从数据库模式中提取表和列名称,并作为你可以想象它们与亚音速生成的“漂亮”名称不匹配。所以我尝试使用 Subsonic.Utilites 类、singleize、ToProper 等的几种组合...但我似乎找不到正确的组合来匹配 subcommander 的输出。
我获得了 SubCommander 2.0 源代码的副本并查看了那里,但我没能找到名称规范化发生的位置。有人可以帮助我找到子命令用来生成表名和列名的实用程序方法的正确组合吗?
如果有什么区别的话,除了fixPluralClassNames =“true”之外,我没有在子命令端的app.config中使用任何特殊的亚音速“开关”。
I am writing some code generation templates that will work hand-in-hand with a SubSonic 2.2 / SubCommander generated classes / assembly. The problem I am having is that SubSonic is using some beautiful magic to normalize the table and column names, singluarize them, pull out extraneous characters etc..
My generated classes (must) are pulling table and column names directly from the database schema and as you can imagine they do not match subsonic's generated "pretty" names. So I have tried to use several combinations of the Subsonic.Utilites classes, singularize, ToProper, etc... But I cannot seem to find the right combination to match what subcommander is outputting.
I was able to get a copy of the SubCommander 2.0 source code and took a look through there but I did not have luck in fiding where the normalization of names is happening. Could someone help me find the right combination of utility methods that subcommander uses to generate table and column names?
If it makes any difference I am not using any special "switches" for subsonic in my app.config on the subcommander side except for fixPluralClassNames="true".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下TableSchema.cs,你可能对以下两项感兴趣
TableColumn 类中 ColumnName 的 setter,调用 TransformPropertyName
setter用于 AbstractTableShema 类中的 TableName,它调用 TransformClassName
还有一些其他调用可以标准化 FK 和关系,但是上面的两个应该让您的类/属性名称与 SubSonic 匹配。
Take a look at TableSchema.cs, your probably interested in the following two items
The setter for ColumnName in TableColumn class, which calls TransformPropertyName
The setter for TableName in AbstractTableShema class, which calls TransformClassName
There are a few other calls to normalize FK and relationships, but those two above should get your class/property names to match SubSonic.