﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » runtime business object creation</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 23 May 2026 14:58:39 GMT</lastBuildDate><ttl>20</ttl><item><title>runtime business object creation</title><link>http://forum.strataframe.net/FindPost11651.aspx</link><description>Hi guys, I try to make a generic ABM, on it I dropped a "copy" button and it must copy the current record of the primary business object on a private business object &lt;br&gt;
&lt;br&gt;
example: I'm retrieving on the ABM a product's table, my currentrowindex is 23 and I like to copy this on a temporary business object with only this record, I not sure how to declare the private variable&lt;br&gt;
&lt;br&gt;
private _boCopy as XXXXXX&lt;br&gt;
&lt;br&gt;
XXXXX mean that I known what is the primary object (the form property say it) but I don't known how to say something like&lt;br&gt;
dim _boCopy as (the type of Myform.PrimaryBusinessObject)&lt;br&gt;
&lt;br&gt;
Thanks and sorry for me newbie questions :w00t:</description><pubDate>Tue, 02 Oct 2007 09:59:09 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11794.aspx</link><description>Hello guys, that's right, some cut &amp; paste to show the example and I make another mistake :w00t: I learn the clearandfillfrom... stuff thanks for all the help and support :)&lt;br&gt;
&lt;br&gt;</description><pubDate>Tue, 02 Oct 2007 09:59:09 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11778.aspx</link><description>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.&amp;nbsp; The other option (ClearAndFillFromCompleteTable) will ignore the filter you set on the business object.</description><pubDate>Tue, 02 Oct 2007 08:51:50 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11774.aspx</link><description>Fabian,&lt;br&gt;
&lt;br&gt;
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.  &lt;br&gt;
&lt;br&gt;
Of course, if what you do have works, I'm not understanding what's happening :D</description><pubDate>Mon, 01 Oct 2007 17:10:53 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11773.aspx</link><description>Solution to this topic (I think :crazy:)&lt;br&gt;
&lt;br&gt;
[quote]dim _copybo as gettype(me.primarybusinessobject) '&lt;---- something like this exist on VB?[/quote]&lt;br&gt;
&lt;br&gt;
I found the solution :w00t: I have to take some class on .net :blush:&lt;br&gt;
&lt;br&gt;
My "full" working code:&lt;br&gt;
--------------&lt;br&gt;
Private _CopyBO As MicroFour.StrataFrame.Business.BusinessLayer&lt;br&gt;
Dim sOldFilter As String = Me.PrimaryBusinessObject.Filter&lt;br&gt;
Dim _CurrentRowIndex As Integer = Me.PrimaryBusinessObject.CurrentRowIndex&lt;br&gt;
&lt;br&gt;
Me.PrimaryBusinessObject.Filter = Me.PrimaryBusinessObject.PrimaryKeyField &amp; " = " &amp; Me.PrimaryBusinessObject(Me.PrimaryBusinessObject.PrimaryKeyField)&lt;br&gt;
&lt;br&gt;
'Instantiate a object from the same type as the primaryBusinessObject&lt;br&gt;
[b]_CopyBO = Activator.CreateInstance(Me.PrimaryBusinessObject.GetType)[/b]&lt;br&gt;
&lt;br&gt;
_CopyBO.CopyDataFrom(Me.PrimaryBusinessObject, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)&lt;br&gt;
&lt;br&gt;
Me.PrimaryBusinessObject.Filter = sOldFilter&lt;br&gt;
&lt;br&gt;
'Me.NavigateToPrimaryKey(_RegistroEnMemoriaBO(_RegistroEnMemoriaBO.PrimaryKeyField))[/quote]&lt;br&gt;
&lt;br&gt;
Now I have a _CopyBO with 1-row copy of my actual PrimaryBusinessObject :)&lt;br&gt;
&lt;br&gt;
Thanks and sorry for all the posts that I write for a simple topic (because my dificulties to write more understand posts)</description><pubDate>Mon, 01 Oct 2007 15:12:56 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11772.aspx</link><description>[quote][b]Trent L. Taylor (09/28/2007)[/b][hr]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.[/quote]&lt;br&gt;
&lt;br&gt;
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 &lt;br&gt;
myform.primarybusinessObject, sometype like:&lt;br&gt;
&lt;br&gt;
dim _copybo as gettype(me.primarybusinessobject) '&lt;---- something like this exist on VB?&lt;br&gt;
&lt;br&gt;
Thanks and sorry for my bad english and all my newbie questions&lt;br&gt;
&lt;br&gt;
--------------------------------------------&lt;br&gt;
I repeat the code that I posted before&lt;br&gt;
&lt;br&gt;
My "full" code:&lt;br&gt;
--------------&lt;br&gt;
Private _CopyBO As [b]New MicroFour.StrataFrame.Business.BusinessLayer[/b]&lt;br&gt;
Dim sFiltroAnterior As String = Me.PrimaryBusinessObject.Filter&lt;br&gt;
Dim _CurrentRowIndex As Integer = Me.PrimaryBusinessObject.CurrentRowIndex&lt;br&gt;
&lt;br&gt;
Me.PrimaryBusinessObject.Filter = Me.PrimaryBusinessObject.PrimaryKeyField &amp; " = " &amp; Me.PrimaryBusinessObject(Me.PrimaryBusinessObject.PrimaryKeyField)&lt;br&gt;
&lt;br&gt;
[b]'-- at this line the "tablename" error ocurrs&lt;br&gt;
_CopyBO.CopyDataFrom(Me.PrimaryBusinessObject, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)&lt;br&gt;
[/b]&lt;br&gt;
Me.PrimaryBusinessObject.Filter = sFiltroAnterior&lt;br&gt;
Me.NavigateToPrimaryKey(_RegistroEnMemoriaBO(_RegistroEnMemoriaBO.PrimaryKeyField))</description><pubDate>Mon, 01 Oct 2007 14:40:58 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11756.aspx</link><description>Yes, this message is because the partial class has not been built.&amp;nbsp; 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.&amp;nbsp; If you HAve built your partial class then something else is going on.&amp;nbsp; Can you post your partial class file here.&amp;nbsp; It will be the MyBo.Designer.vb file.</description><pubDate>Fri, 28 Sep 2007 15:02:49 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11752.aspx</link><description>Yes, I build all the project to test it, I tested with some BOs and same error....&lt;br&gt;
I have an CRUD working, when I press the "copy" button with the last post code, the message appears:&lt;br&gt;
&lt;br&gt;
NotImplementedException&lt;br&gt;
  The class [MicroFour.StrataFrame.Business.BusinessLayer] must override the property 'TableName' since it derives from MicroFour.StrataFrame.Business.BusinessLayer.&lt;br&gt;
&lt;br&gt;
Source     : MicroFour StrataFrame Business&lt;br&gt;
&lt;br&gt;
Stack Trace: &lt;br&gt;
   en MicroFour.StrataFrame.Business.BusinessLayer.get_TableName()&lt;br&gt;
   en MicroFour.StrataFrame.Business.BusinessLayer.CreateInternalTable()&lt;br&gt;
   en MicroFour.StrataFrame.Business.BusinessLayer.get__CurrentDataTable(Boolean IsSharedTable)&lt;br&gt;
   en MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(DataTable NewTable, Boolean AcceptChanges, Boolean IsSharedTable)&lt;br&gt;
   en MicroFour.StrataFrame.Business.BusinessLayer.CopyDataFrom(BusinessLayerBase BusinessObject, BusinessCloneDataType CopyType)&lt;br&gt;
   en Integra4.SFStandardFormBaseABM.CopiarRegistro() en C:et\SISTEMA\integra4\Clases Base\formularios\SFStandardFormBaseABM.vb:línea 157&lt;br&gt;
   en Integra4.SFStandardFormBaseABM.tsbCopiar_Click(Object sender, EventArgs e) en C:et\SISTEMA\integra4\Clases Base\formularios\SFStandardFormBaseABM.vb:línea 107&lt;br&gt;
   en System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)&lt;br&gt;
   en System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)&lt;br&gt;
   en System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)&lt;br&gt;
   en System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)&lt;br&gt;
   en System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)&lt;br&gt;
   en System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)&lt;br&gt;
   en System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)&lt;br&gt;
   en System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)&lt;br&gt;
   en System.Windows.Forms.Control.WndProc(Message&amp; m)&lt;br&gt;
   en System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m)&lt;br&gt;
   en System.Windows.Forms.ToolStrip.WndProc(Message&amp; m)&lt;br&gt;
   en System.Windows.Forms.Control.ControlNative&amp;#119;indow.OnMessage(Message&amp; m)&lt;br&gt;
   en System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(Message&amp; m)&lt;br&gt;
   en System.Windows.Forms.Native&amp;#119;indow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
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"&lt;br&gt;
&lt;br&gt;
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? :/&lt;br&gt;
&lt;br&gt;
Thanks for all</description><pubDate>Fri, 28 Sep 2007 11:45:04 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11730.aspx</link><description>Have you built the partial class for the BO you are working with?</description><pubDate>Thu, 27 Sep 2007 11:13:27 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11717.aspx</link><description>I say "Victory" too fast&lt;br&gt;
&lt;br&gt;
when I set&lt;br&gt;
Private _CopyBO As MicroFour.StrataFrame.Business.BusinessLayer&lt;br&gt;
&lt;br&gt;
when I try to use _CopyBO, VB.net say that I have to instantiate the class&lt;br&gt;
&lt;br&gt;
then, I set&lt;br&gt;
 Private _CopyBO As New MicroFour.StrataFrame.Business.BusinessLayer&lt;br&gt;
&lt;br&gt;
When I try to use&lt;br&gt;
 _CopyBO.CopyDataFrom(Me.PrimaryBusinessObject, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)&lt;br&gt;
&lt;br&gt;
[b]a message "The class "Microfour...BussinesLayer" must override the property "Tablename" since it derives from Microf.....Businesslayer&lt;br&gt;
[/b]&lt;br&gt;
&lt;br&gt;
What Can I do?&lt;br&gt;
&lt;br&gt;
My "full" code:&lt;br&gt;
--------------&lt;br&gt;
Private _RegistroEnMemoriaBO As New MicroFour.StrataFrame.Business.BusinessLayer&lt;br&gt;
Dim sFiltroAnterior As String = Me.PrimaryBusinessObject.Filter&lt;br&gt;
Dim _CurrentRowIndex As Integer = Me.PrimaryBusinessObject.CurrentRowIndex&lt;br&gt;
&lt;br&gt;
Me.PrimaryBusinessObject.Filter = Me.PrimaryBusinessObject.PrimaryKeyField &amp; " = " &amp; Me.PrimaryBusinessObject(Me.PrimaryBusinessObject.PrimaryKeyField)&lt;br&gt;
&lt;br&gt;
'-- at this line the "tablename" error ocurrs&lt;br&gt;
_RegistroEnMemoriaBO.CopyDataFrom(Me.PrimaryBusinessObject, MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)&lt;br&gt;
&lt;br&gt;
Me.PrimaryBusinessObject.Filter = sFiltroAnterior&lt;br&gt;
Me.NavigateToPrimaryKey(_RegistroEnMemoriaBO(_RegistroEnMemoriaBO.PrimaryKeyField))&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;</description><pubDate>Wed, 26 Sep 2007 13:27:30 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11710.aspx</link><description>How To obtain the current record from the PrimaryBusinessObject of a Form&lt;br&gt;
&lt;br&gt;
in the last post I try to obtain the current record but I don't known how to set the filter&lt;br&gt;
&lt;br&gt;
I try with &lt;br&gt;
[codesnippet]&lt;br&gt;
me.primarybusinessObject.filter = me.primarybusinessObject.PrimaryKeyField.Tostring() &amp; "=" &amp; me.primarybusinessobject.(me.PrimaryBusinessObject.PrimaryKeyField.tostring())&lt;br&gt;
[/codesnippet]&lt;br&gt;
but this doesn't work, after some googling I see that I can use:&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
Me.PrimaryBusinessObject.Filter = Me.PrimaryBusinessObject.PrimaryKeyField &amp; " = " &amp; Me.PrimaryBusinessObject(Me.PrimaryBusinessObject.PrimaryKeyField)&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
Sorry for all those questions and thanks for all :)</description><pubDate>Wed, 26 Sep 2007 10:58:35 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11699.aspx</link><description>Yes, Fabian, that will work, but you'll need to make sure that you remove the filter when you're done or you won't be able to Navigate or Move to any new records.</description><pubDate>Wed, 26 Sep 2007 09:06:32 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11688.aspx</link><description>[quote][b]Trent L. Taylor (09/24/2007)[/b][hr]Well, a business object has a CopyDataFrom method that allows data from one BO to be copied to another. This also has some overloads and parms that allow you to specify whether you want to copy the filtered BO (DefaultView) or the CurrentDataTable which ignores the filter. So if you want to copy a single record, apply a filter to the source BO then call the CopyDataFrom on the destination BO using a DefaultView option.&lt;br&gt;
&lt;br&gt;
[codesnippet]SourceBO.Filter = "MyPK = " &amp;amp; SourceBO.MyPk.ToString()&lt;br&gt;
DestBO.CopyDataFrom(SourceBO,ClearAndFillFromDefaultView)[/codesnippet][/quote]&lt;br&gt;
&lt;br&gt;
how I can say something like "MyPK = " &amp; SourceBO.MyPK.Tostring() in a general manner to filter the current record? I say something like:&lt;br&gt;
&lt;br&gt;
 me.primarybusinessObject.filter = me.primarybusinessObject.PrimaryKeyField.Tostring() &amp; "=" &amp; me.primarybusinessobject.(me.PrimaryBusinessObject.PrimaryKeyField.tostring())&lt;br&gt;
&lt;br&gt;
Thanks and sorry for all the questions :w00t:</description><pubDate>Tue, 25 Sep 2007 15:18:15 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11678.aspx</link><description>You will want to use the base class which would be BusinessLayer:&lt;/P&gt;&lt;P&gt;[codesnippet]Dim _CopyBO As MicroFour.StrataFrame.Business.BusinessLayer[/codesnippet]&lt;/P&gt;&lt;P&gt;This will allow any BO to be passed into that variable while giving you the ability to reference all of the base classes.&amp;nbsp; If you want to have the type of BO passed in then you will want to take a more technical approach using Generics.&amp;nbsp; This is a more length explanation as Generics are a wonderful tool but they require more explanation.</description><pubDate>Tue, 25 Sep 2007 10:45:30 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11677.aspx</link><description>thanks for reply, my question I think is more a .net question about object types, I don't sure how to define the destination object in run time without known what type of BO it is &lt;br&gt;
&lt;br&gt;
Example:I have a me.PrimaryBusinessObject, when I press a "Copy" button I handle it....&lt;br&gt;
[codesnippet]&lt;br&gt;
Sub Copy_Click&lt;br&gt;
     ' I like to copy the current record on the me.Primarybusinessobject to a variable &lt;br&gt;
     '  called _CopyBO (it can be testbo1, otherBo1 or another BO)&lt;br&gt;
      dim _CopyBO as XXXXXXX '&lt;--- [b]how I declare the type of the primarybusinessobject here?[/b]&lt;br&gt;
      'Copy the row from XXXBO1 to _CopyNO....&lt;br&gt;
       ' some code here....&lt;br&gt;
end sub&lt;br&gt;
[/codesnippet]&lt;br&gt;
--------------------&lt;br&gt;
Thanks :)</description><pubDate>Tue, 25 Sep 2007 10:07:20 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11665.aspx</link><description>Well, a business object has a CopyDataFrom method that allows data from one BO to be copied to another.&amp;nbsp; This also has some overloads and parms that allow you to specify whether you want to copy the filtered BO (DefaultView) or the CurrentDataTable which ignores the filter.&amp;nbsp; So if you want to copy a single record, apply a filter to the source BO then call the CopyDataFrom on the destination BO using a DefaultView option.&lt;/P&gt;&lt;P&gt;[codesnippet]SourceBO.Filter = "MyPK = " &amp;amp; SourceBO.MyPk.ToString()&lt;BR&gt;DestBO.CopyDataFrom(SourceBO,ClearAndFillFromDefaultView)[/codesnippet]</description><pubDate>Mon, 24 Sep 2007 21:15:55 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: runtime business object creation</title><link>http://forum.strataframe.net/FindPost11652.aspx</link><description>I not sure if I clear on the last post, I try to make something like the VFP "scat memo" / appe blank / "gath memo" to copy a record into another new record, I not sure if a temporal 1-row business object is the correct stuff to do&lt;br&gt;</description><pubDate>Mon, 24 Sep 2007 12:25:17 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item></channel></rss>