Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
It looks as though you are going about this correctly, but the code snippet you gave doesn't show the whole picture. But in short, if your foreign keys are getting updated, then you are in good shape.
|
|
|
Felix M Avendano
|
|
Group: Forum Members
Posts: 48,
Visits: 1.5K
|
I was working around with this and there ares somethings I ´m not sure. Actually it does´t work as I espect. Sopouse I´ve got a BOparent and a BOChild Private Sub BoParent_ParentFormLoading() Handles BoParent1.ParentFormLoading ... BoParent1.RegisterForeignKey(BOchild, "ChildFKFieldname") ... End Sub Is this correct. Or I have to put this in the BO instead of the instance of it? I have to use the method of the parent or the child's one. That's all Regards and, the method is correct? or there is something better.
|
|
|
Felix M Avendano
|
|
Group: Forum Members
Posts: 48,
Visits: 1.5K
|
I´ve was working around with this but I´m not getting the same result as using the properties. So here are some questions. Supouse Ive got BOParent and BOChild. Private Sub BOChild_ParentFormLoading() Handles BoEmpresa1.ParentFormLoading ... BOParent.RegisterForeignKey(BOchild, "ChildFKFieldname") .... End Sub
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
So what you are saying is that you need to register more than one foreign key for the BO, correct? You can use the RegisterForeignKey method on the BO and pass over the child BO and the key information. This must be done in code, but will server the exact same purpose as the standard ParentRelationship property available through the designer.
|
|
|
Felix M Avendano
|
|
Group: Forum Members
Posts: 48,
Visits: 1.5K
|
Now I have something good!!! If I put Empresa as parent key works fine. The problem is, what about having two or more foreing keys. I cannot put more than one parent.
|
|
|
Felix M Avendano
|
|
Group: Forum Members
Posts: 48,
Visits: 1.5K
|
I've finally found where the error is: at windowsaplication1.BOempresa (is a BO of course ) Public Overrides Function GetValue(ByVal component As Object) As Object Select Case Me.Field Case BOEmpresaFieldNames.Descripcion Return DirectCast(component, BOEmpresa).Descripcion Case BOEmpresaFieldNames.CUIT Return DirectCast(component, BOEmpresa).CUIT Case BOEmpresaFieldNames.Dirección Return DirectCast(component, BOEmpresa).Dirección Case BOEmpresaFieldNames.Ubicacion Return DirectCast(component, BOEmpresa).Ubicacion Case BOEmpresaFieldNames.Empresa (after passing 4 times here) Return DirectCast(component, BOEmpresa).Empresa Case Else Throw New BusinessLayerException("Field not supported.") End Select End Function
|
|
|
Felix M Avendano
|
|
Group: Forum Members
Posts: 48,
Visits: 1.5K
|
It did work fine, but I still have a problem. I tried to simplyfied it the best I could in one form because I have this in 3 forms and I cannot solve it. Let's see. I have a Datagridview bounded via a BBS to a first BO. The Data... has a combobox inthere bounded to a second BO via a second BBS. I populate evreything as well and when I try to add a record using the datagrid directly, or via a Button with the add function is the same, I have a very ugly message, but I cannot debug it, or I don't know how to do it. Ill attach you the message window.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Yup, please download the most recent build and see if your problem persists. Thanks.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
That problem was fixed in the latest version 1.7.0.2, download it from your account and you should be good.
Edhy Rijo
|
|
|
Felix M Avendano
|
|
Group: Forum Members
Posts: 48,
Visits: 1.5K
|
Ive change everything as suggested and now I have 2 Comboboxes bounded to a cuple od BO's and a datagridview bounded to a BBS and this bbs to a BO. Everything works fine intil I try to exit the form. When I go out of it thru the close form icon I get this error. Any Clue, because I cant debug it because it doesn't pass thru my code. KeyNotFoundException La clave proporcionada no se encontró en el diccionario. (the key provided is not found in the diccionary) Source : mscorlib Stack Trace: en System.ThrowHelper.ThrowKeyNotFoundException() en System.Collections.Generic.Dictionary`2.get_Item(TKey key) en MicroFour.StrataFrame.Business.BusinessLayer.get__CurrentDataTable(Boolean IsSharedTable) en MicroFour.StrataFrame.Business.BusinessLayer.get_Count() en MicroFour.StrataFrame.Business.BusinessBindingSource.get_IBindingListView_Count() en System.Windows.Forms.CurrencyManager.get_Count() en System.Windows.Forms.DataGridViewCell.GetValue(Int32 rowIndex) en System.Windows.Forms.DataGridViewCell.GetFormattedValue(Int32 rowIndex, DataGridViewCellStyle& cellStyle, DataGridViewDataErrorContexts context) en System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex, Size constraintSize) en System.Windows.Forms.DataGridViewCell.GetPreferredWidth(Int32 rowIndex, Int32 height) en System.Windows.Forms.DataGridViewCell.OnCellDataAreaMouseEnterInternal(Int32 rowIndex) en System.Windows.Forms.DataGridViewCell.OnMouseMoveInternal(DataGridViewCellMouseEventArgs e) en System.Windows.Forms.DataGridView.OnCellMouseMove(DataGridViewCellMouseEventArgs e) en System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo hti, MouseEventArgs e) en System.Windows.Forms.DataGridView.OnMouseMove(MouseEventArgs e) en System.Windows.Forms.Control.WmMouseMove(Message& m) en System.Windows.Forms.Control.WndProc(Message& m) en System.Windows.Forms.DataGridView.WndProc(Message& m) en System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m) en System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m) en System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
|
|