icon

CodeTrigger   Forum

Code Generation For C#, WPF, WCF, SQL SERVER/ORACLE/MYSQL and Visual Studio 2013-2017

HomeGeneral

General Discussion Board - Please post questions, answers, (polite) opinions, and use-cases. Moderators reserve the right to amend the text/subject line or re-categorise the post to better suit the forum configuration if necessary.

Lookup tables result in no edit code functionality Messages in this topic - RSS

migrator
04/12/2017
migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
Hi I just generated code for two simple tables and one came out with edit,delete links per row but the other one did not. What determines when these update links show. Both tables have PK columns defined. Thanks, José
0 link
04/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
Hi, Edit Links/code is/are generated when a table has a simple primary key, and NOT ALL the columns in the table are in the primary key. For example, lookup tables which contain two columns, but both of the columns are part of the primary key, will not be treated as editable, by the generated UI code
0 link
04/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
Thanks for your quick response. I just checked and yes, one had two pk columns. Do you have a sample code or suggested way to go about generating the code for these multi-key tables? Or do I just have to modify it myself manually? Thanks again.
0 link
04/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
Hi,
This can be resolved by changing the db schema in one or both of the following ways, and re-running the code generation:

(1) Creating a new single column on the table as the primary key, perhaps an auto incrementing identity column
(2) In the case of a lookup table that only has reference columns eg TABLE (FK1, FK2), try making adding an extra non-reference column eg TABLE (FK1, FK2, [DESC])

Then re-run code generation, and the issue will be resolved.


If you are not authorised to change the db schema for some reason, then you will have to manually extend the generated classes, by creating extension partial classes to the DAO and BO classes, with edit methods.
This should not require you to make changes to the actual files generated by CodeTrigger, as your extended partial class code will be in extra files, perhaps in an 'extension' folder. However if you do change the code in the generated files,
make sure you 'escape' those files in the advanced options 'escaped files' list, so that your changes are not overwritten.
0 link