not sure if this is the correct spot to post this so forgive me if it is not.
I am trying to use codesmith to generate an 'EditableRoot' or any 'Root' class based on a stored proc.and i keep getting this error. I have downloaded the new 9.5 codetemplate files and i am using a trial version of codesmith.
this is a proc that is currently being used and works fine outside of codesmith. Also, there is a primary key set in the database. I even changed the key to 'uniqueidentifier' in the hopes that it would work, but no luck. I have also tried adding all the columns returned in the proc within the "uniqueColumnNames' filed.
I have recreated the PTracker datascheme and i do not get this error when running against those Procs.
Anyone have any idea's????
There are 2 things are required when use stored proc as data source to generate code.
1. Must use retrieve/get stored proc which usually return 1 or more result sets.
2. Specify the pk in UniqueColumnNames, since the template does not know which columns in the result set is the pk column.
Please see other post from Tom Cooley regarding the use of sp as data source:
http://forums.lhotka.net/forums/thread/2648.aspx
http://community.codesmithtools.com/forums/permalink/12325/13166/ShowThread.aspx#13166
HTH,
Ricky
Thanks for the link to the other two posts.
I had the primary key set and tried using that in the UniqueColumnNames but still got the same error.
I rewrote the existing Proc and it now works just fine. go figure ( though this datascheme is not very good. Have to love legacey stuff)
I've got this same problem and have been digging for an answer for a while now. I have assigned a primary key and still get the following error with the templates, but only on the EditableRoot.cst! (EditableChild works fine):
System.Exception: Unique Column(s) is required.
at CodeSmith.Csla.ObjectInfo.Validate()
at CodeSmith.Csla.ObjectInfo..ctor(CodeTemplate template)
at _CodeSmithTemplate.EditableRoot_cst.__RenderMethod1(TextWriter writer, Control control)
at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
at CodeSmith.Engine.CodeTemplate.RenderToString()
at CodeSmith.Gui.CodeTemplateGenerator.b(Object , EventArgs )
It's working for EditableChild.cst fine when assigning the UniqueColumnNames value
Copyright (c) Marimer LLC