StrataFrame Forum

SecurityDialog - Foreign Key Error (Project Code)

http://forum.strataframe.net/Topic11654.aspx

By Zachary Paul Pennington - 9/24/2007

I have embedded the SecurityDialog in my prototype application.

When the user adds Users or Roles, a Foreign Key error is thrown (on Project Code).

Also the securityForm.ProjectPK property == 0.



The Security Key is valid (SetSecurityKeyAndVectorForUserAuthentication) -- I can authenticate users and authorize access to Forms.



Is this a configuration issue?

Can you suggest a fix?





Below: stack trace for error when adding a user:



at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)

at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save(Boolean Transactional, String TransactionKey)

at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save()

at MicroFour.StrataFrame.Security.UserEditor.cmdSave_Click(Object sender, EventArgs e)

at System.Windows.Forms.Control.OnClick(EventArgs e)

at System.Windows.Forms.Button.OnClick(EventArgs e)

...
By Trent L. Taylor - 9/24/2007

You do not have projects at run-time.  The ProjectPK is ONLY used through the Visual Studio designer so that you....the developer...can create projects that are deployed to your end-user.  When deployed, the projects table is not deployed and is not referenced or used.  This is for design-time purposes only.

There is really not enough of a stack trace to see the exact error.  However, I am farily confident that you do not have the SecurityDataSource pointing to the right location...or...you do not have the security tables deployed to your database.  By default the security data source will use the default data source.  So if your security tables are in the same database as your deployed database then you will not have any trouble and you do not need to set this.

When you indicate "embedded" are you just referring to calling the SecurityDialog() form through the SF reference or did you do something with the SF source code?

Any additional steps that you could provide would be helpful as well as a full stack trace.  Thanks. Smile

By Zachary Paul Pennington - 9/25/2007

Thanks, Trent. You were right.



I was still running locally, from the design-time "StrataFrame" database.

I now understand that, even when running locally, we need to deploy the SFS data to a runtime database -- OK!



From "the manual" -- (SecurityHelp.chm)

Without the DDT, you must manually add the SFS* tables to your database script for deployment and devise a method to deploy the contents of the SFS* tables in the StrataFrame (design-time) database to your application’s database at runtime. You only need to gather the records that match your project, identified by the appropriate record within the SFSProjects table.




I am farily confident that you do not have the SecurityDataSource pointing to the right location...or...you do not have the security tables deployed to your database.