Errors In Generated Files

<< >>

Navigation:  CodeStencil > Troubleshooting >

Errors In Generated Files

 

It is possible to get this error after code generation:

 

CS_clip0178

 

Followed by this:

 

CS_clip0179

 

 

These are the possible causes of these errors:

 

Scenario 1

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.

 

CS_clip0180

 

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.

 

 

Scenario 2

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)

 

CS_clip0199

 

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:

 

CS_clip0200

 

And to fix this, you can just mark one of the fields as a primary key:

 

CS_clip0201