Hi Thomas, I've been thinking about this for a little bit. In short, I'm not sure of the exact problem.
If you have a form and the form field is named fkTableID, and you pass TableID, then I would expect there to be an issue. You may be able to use an alias to change this, so that the values match. It's been a while since I used the Scaffolding Functionality of Model Glue. While it's pretty good, it isn't perfect and there are things it just doesn't do automatically. You could, however, edit the generated HTML and rename the field if you wanted to. That way you get all the benefit of the code generation and also you get the flexibility of making it work the way you want. If I have misunderstood your current issue, please write back. How this works is still a little fuzzy since I haven't used scaffolding in a little bit. DW On Fri, Oct 22, 2010 at 8:35 AM, Thomas <[email protected]> wrote: > Hi everyone > > I am having some problems with scaffolding and foreign key prefixes. > I'm using MG 3.2.700.341 with reactor as ORM. > > If the primary key of a table is TableID then I use fkTableID for the > foreign key in an other table. > > The scaffolding forms and pages are generated and working, the foreign > key is a select box in the edit form. > So far so good. If I want to to add or edit an entry then I get the > following error: > > [Macromedia][SQLServer JDBC Driver][SQLServer]The INSERT statement > conflicted with the FOREIGN KEY constraint "FK_MenuPunkt_MenuGruppe". > The conflict occurred in database "ProdukteKatalog", table > "dbo.MenuGruppe", column 'MenuGruppeID'. > > If I remove the relationship between the 2 tables on SQL Server, I can > see that the fk is always 0. If the foreign key and the primary key > have the same name, then inserting and editing works fine. > > Is it possible to have different names for pk and fk or do they have > to be the same? > > Thanks in advance for any hints > > Thomas > > Reactor.xml config: > <object name="MenuPunkt"> > <hasOne name="MenuGruppe"> > <relate from="fkMenuGruppeID" to="MenuGruppeID" /> > </hasOne> > </object> > <object name="MenuGruppe"> > <hasMany name="MenuPunkt"> > <relate from="MenuGruppeID" to="fkMenuGruppeID" /> > </hasMany> > </object> > > ModelGlue.xml config: > <scaffold object="MenuPunkt"> > <results> > <result do="template.main" /> > </results> > </scaffold> > <scaffold object="MenuGruppe"> > <results> > <result do="template.main" /> > </results> > </scaffold> > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<model-glue%[email protected]> > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en -- William Osler - "We are here to add what we can to life, not to get what we can from life." -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en
