Navigation: CodeStencil > Troubleshooting > Errors In Generated Files |
It is possible to get this error after code generation:
Followed by this:
These are the possible causes of these errors:
Now, let us examine one of the files listed here, we will look at : c:\temp\codestencil\Project16\src\Project16\Controllers\VGetAllCategoriesController.cs
In the PUT method, we can see that the Expander/Code Nanite ( highlighted in yellow) was not transformed into the required text/code which was supposed to be Primary key of the current "Table" being processed.
Unfortunately, this wasn't a Table, but a View, and Views do not have primary keys. Now, this is not a flaw in the CodeStencil application, rather, an oversight is the stencil that is generating this code.
It is also possible to get a similar error where untransformed code is generated, thereby getting a similar kind of warning. However, this may be as a result of the required Code nanite either missing or not loaded.
To fix this, inform the publisher of the stencil about this error so that the publisher can provide a version that properly handles VIEWS and will not generate CUD (Create, Update, Delete) methods for VIEWs.
Here is another scenario where you can get "Errors in generated file(s)" errors. This is the case where no primary key has been selected ( Especially in the case of an intermediate table)
So, if you have a Stencil that automatically generates primary keys, your generated file will show an untransformed Code Nanite as show in this razor file:
And to fix this, you can just mark one of the fields as a primary key: