StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


««12

runtime business object creationExpand / Collapse
Author
Message
Posted 09/28/2007 11:45:04 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/27/2008 2:42:57 PM
Posts: 112, Visits: 665
Yes, I build all the project to test it, I tested with some BOs and same error....
I have an CRUD working, when I press the "copy" button with the last post code, the message appears:

NotImplementedException
The class [MicroFour.StrataFrame.Business.BusinessLayer] must override the property 'TableName' since it derives from MicroFour.StrataFrame.Business.BusinessLayer.

Source : MicroFour StrataFrame Business

Stack Trace:
en MicroFour.StrataFrame.Business.BusinessLayer.get_TableName()
en MicroFour.StrataFrame.Business.BusinessLayer.CreateInternalTable()
en MicroFour.StrataFrame.Business.BusinessLayer.get__CurrentDataTable(Boolean IsSharedTable)
en MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(DataTable NewTable, Boolean AcceptChanges, Boolean IsSharedTable)
en MicroFour.StrataFrame.Business.BusinessLayer.CopyDataFrom(BusinessLayerBase BusinessObject, BusinessCloneDataType CopyType)
en Integra4.SFStandardFormBaseABM.CopiarRegistro() en C:et\SISTEMA\integra4\Clases Base\formularios\SFStandardFormBaseABM.vb:línea 157
en Integra4.SFStandardFormBaseABM.tsbCopiar_Click(Object sender, EventArgs e) en C:et\SISTEMA\integra4\Clases Base\formularios\SFStandardFormBaseABM.vb:línea 107
en System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
en System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
en System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
en System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
en System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
en System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
en System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ScrollableControl.WndProc(Message& m)
en System.Windows.Forms.ToolStrip.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)


I tested to declare _CopyBO as BusinessObject (ej: as TESTBO1) instead of "as bussinesslayer" and It worked partially...it copy the datatable..... but I have the properties of testBO1, not the actual me.PrimaryBusinessObject BusinessObject, the unique thing that I see that I can do is to declare _copyBO as [theCorrectTypeBO here], not other solution to copy the current row to call it back later like "me.primarybusinessobject.someFieldOnSqlProperty = _copyBO.someFieldOnSqlProperty"

I think that the best I can do to copy the actual record from some BO is to copy the current dataRow and restore it later... Any best idea? :/

Thanks for all
Post #11752
Posted 09/28/2007 3:02:49 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 4:17:19 AM
Posts: 4,379, Visits: 4,420
Yes, this message is because the partial class has not been built.  When we create the partial class for the BO we automatically overwrite the TableName property, which on the BO you are referring does not have it overwritten so thus you get the error.  If you HAve built your partial class then something else is going on.  Can you post your partial class file here.  It will be the MyBo.Designer.vb file.
Post #11756
Posted 10/01/2007 2:40:58 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/27/2008 2:42:57 PM
Posts: 112, Visits: 665
Trent L. Taylor (09/28/2007)
Yes, this message is because the partial class has not been built. When we create the partial class for the BO we automatically overwrite the TableName property, which on the BO you are referring does not have it overwritten so thus you get the error. If you HAve built your partial class then something else is going on. Can you post your partial class file here. It will be the MyBo.Designer.vb file.


I think that the problem is that I like to create the copy of a (unknown yet on design) new business object (I trying to create a generic CRUD) and can´t use the businesslayer to define the type of _CopyBO" because it don't override the tablename property :S I not sure how to avoid this problem and copy a single record from the primarybusinessobject into a temporal 1-row business object copy, I don´t known how I can declare the _copyBO as same type that
myform.primarybusinessObject, sometype like:

dim _copybo as gettype(me.primarybusinessobject) '<---- something like this exist on VB?

Thanks and sorry for my bad english and all my newbie questions

--------------------------------------------
I repeat the code that I posted before

My "full" code:
--------------
Private _CopyBO As New MicroFour.StrataFrame.Business.BusinessLayer
Dim sFiltroAnterior As String = Me.PrimaryBusinessObject.Filter
Dim _CurrentRowIndex As Integer = Me.PrimaryBusinessObject.CurrentRowIndex

Me.PrimaryBusinessObject.Filter = Me.PrimaryBusinessObject.PrimaryKeyField & " = " & Me.PrimaryBusinessObject(Me.PrimaryBusinessObject.PrimaryKeyField)

'-- at this line the "tablename" error ocurrs
_CopyBO.CopyDataFrom(Me.PrimaryBusinessObject, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)

Me.PrimaryBusinessObject.Filter = sFiltroAnterior
Me.NavigateToPrimaryKey(_RegistroEnMemoriaBO(_RegistroEnMemoriaBO.PrimaryKeyField))
Post #11772
Posted 10/01/2007 3:12:56 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/27/2008 2:42:57 PM
Posts: 112, Visits: 665
Solution to this topic (I think :crazy

dim _copybo as gettype(me.primarybusinessobject) '<---- something like this exist on VB?


I found the solution I have to take some class on .net

My "full" working code:
--------------
Private _CopyBO As MicroFour.StrataFrame.Business.BusinessLayer
Dim sOldFilter As String = Me.PrimaryBusinessObject.Filter
Dim _CurrentRowIndex As Integer = Me.PrimaryBusinessObject.CurrentRowIndex

Me.PrimaryBusinessObject.Filter = Me.PrimaryBusinessObject.PrimaryKeyField & " = " & Me.PrimaryBusinessObject(Me.PrimaryBusinessObject.PrimaryKeyField)

'Instantiate a object from the same type as the primaryBusinessObject
_CopyBO = Activator.CreateInstance(Me.PrimaryBusinessObject.GetType)

_CopyBO.CopyDataFrom(Me.PrimaryBusinessObject, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)

Me.PrimaryBusinessObject.Filter = sOldFilter

'Me.NavigateToPrimaryKey(_RegistroEnMemoriaBO(_RegistroEnMemoriaBO.PrimaryKeyField))[/quote]

Now I have a _CopyBO with 1-row copy of my actual PrimaryBusinessObject

Thanks and sorry for all the posts that I write for a simple topic (because my dificulties to write more understand posts)
Post #11773
Posted 10/01/2007 5:10:53 PM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Yesterday @ 7:31:07 PM
Posts: 1,241, Visits: 3,131
Fabian,

I think that the code posted won't have just one record (unless the primary BO only has one record). When you do the CopyDataFrom, you need to supply the ClearAndFillFromDefaultView option to get just the filtered records.

Of course, if what you do have works, I'm not understanding what's happening
Post #11774
Posted 10/02/2007 8:51:50 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 5:02:56 PM
Posts: 2,682, Visits: 1,882
Yep, Greg is correct... if you filter out all but 1 row, and you want to copy just that one row, then you will need to use the ClearAndFillFromDefaultView.  The other option (ClearAndFillFromCompleteTable) will ignore the filter you set on the business object.


www.bungie.net
Post #11778
Posted 10/02/2007 9:59:09 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 08/27/2008 2:42:57 PM
Posts: 112, Visits: 665
Hello guys, that's right, some cut & paste to show the example and I make another mistake I learn the clearandfillfrom... stuff thanks for all the help and support

Post #11794
« Prev Topic | Next Topic »

««12

Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 6:26pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.141. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.