简体   繁体   English

SubSonic 2.2类生成

[英]SubSonic 2.2 Class Generation

I am using SubSonic on a project with many tables which were created by a sourcecode generator. 我在一个具有许多由源代码生成器创建的表的项目上使用SubSonic。 I noticed Some classes created by SubSonic were generated without code and have the folowing message 我注意到SubSonic创建的某些类是在没有代码的情况下生成的,并且具有以下信息

The class...was not generated because ... does not have a primary key.

Is there any way for me to get the code to be generated without adding keyes to all the tables? 我有什么办法可以在不向所有表添加键的情况下获取要生成的代码?

Thanks 谢谢

Add primary key to table. 将主键添加到表。 You can create an auto-increment int field as primary key. 您可以创建一个自动增量int字段作为主键。

This happens with almost every database layer code generator, because without primary key it cannot generate edit/delete functionality. 几乎每个数据库层代码生成器都会发生这种情况,因为没有主键,它将无法生成编辑/删除功能。

SubSonic requires primary keys on tables to generate its code. SubSonic需要表上的主键来生成其代码。

From the documentation: http://subsonicproject.com/docs/Conventions 从文档中: http : //subsonicproject.com/docs/Conventions

Primary Keys 主键

If you want to use SubSonic to access your table, you need to have a Primary Key defined for your table. 如果要使用SubSonic访问表,则需要为表定义一个主键。 This is good practice in every case and we need it to do certain things with your table. 在每种情况下,这都是一个好习惯,我们需要它对您的表进行某些操作。 If you don't have a Primary Key defined, your class won't be generated. 如果没有定义主键,则不会生成您的类。

If you don't believe us, or if you think this is a silly convention - SubSonic isn't for you. 如果您不相信我们,或者您认为这是一个愚蠢的约定-SubSonic不适合您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM