Passing a BusinessObject by reference


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I want to pass a BusinessObject by reference into a method, as I want the BO changed in the method, and the resultant chnged BO available in the calling routine. I have set up a very simple method for illustration purposes(does not do anything)

TestMethod(ref KernelBaseSF.KernelBO myBO)
{ int x;  x=1}
(KernelBaseSF.KernelBO is my Subclass of the MicroFour.StrataFrame.Business.BusinessLayer)

 Now, the following does NOT give a compile error:
KernelBaseSF.KernelBO bo = new KernelBaseSF.KernelBO();
KEK001.TestMethod(ref bo);
However, if I try to use a BO thats dropped on the form as in:
KEK001.TestMethod(ref this.KmaBO1) 
 I get an Error 6 The best overloaded method match for 'KEKCommon.KEK001.TestMethod(ref KernelBaseSF.KernelBO)' has some invalid arguments C:\KEK\Kernel_App\Scp_Maint.cs 242 13 Kernel_App


If I just take out the ref parameter in the calling and called methods,it compiles ok, so it looks like there is an issue, for calling by ref, of a BO dropped on the form
Replies
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Edhy.

I have re-engineered my requirement slightly and rather than returning the BO, I just return the Key into the table, which works fine for the moment, and should be a lot simpler as no BO is involved.

I am in the process currently of trying to make the controls I use all the time as generic as possible. The specific control I am working on is basically for a lookup /grid, and I call a method with code like   Lookup(myBO, SerachString) . The Lookup then looks at the table name attached to the BO, and accesses another table to get DataDriven Field names,as well as a bunch of other parameters like Sortable, Total Column, Column Width etc.. I then use the DataDriven Field parameters to construct a Devexpress Grid, whcih is then used as either the Lookup, or a conventional Grid. This all seems to work quite well with not that much code behind it. 

The main reason I need this is,  that our users need to be able to decide on what columns they see in a grid...so it means that the user can decide whcih columns and how the columns appear.
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Gerard O Carroll (8/30/2011)
I have re-engineered my requirement slightly and rather than returning the BO, I just return the Key into the table, which works fine for the moment, and should be a lot simpler as no BO is involved.

Good I always try to keep things simple and easier to provide maintenance later on.

I am in the process currently of trying to make the controls I use all the time as generic as possible.

Me too.  As a consultant I try to re-use every class I can in all my projects so I can be handle things faster and more reliable.

The main reason I need this is,  that our users need to be able to decide on what columns they see in a grid...so it means that the user can decide which columns and how the columns appear.

I am new using DevExpress grids, but I believe you can have a standard layout and then you can save/restore the layout at runtime.  I use the RibbonBar a lot and there are some settings I save in the registry using SF SaveSizeAndLocation() and RestoreSizeAndLocation() of my main form, but I noticed in the Layout of GridControl Designer that you can Save it to an XML or Load it from an XML, I have not tried that yet, but that seems to be the easiest way to allow the end user to add customization to the gridcontrol, you can have a customization table linked to the SF User's table where you can store all your XML settings, this way it would be available to the End User from any workstation.

Edhy Rijo

Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Gerard,
Looking at the DevExpress videos I came across to this one http://tv.devexpress.com/XtraGridSaveCustomizations.movie which shows you how to save/restore grid's layout views, it may fit your needs and very easy to implement.

Edhy Rijo

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Not sure this would help, but here is an Infragistics inherited Grid I posted a while ago that saves its own position and layout.

http://forum.strataframe.net/FindPost27157.aspx
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ger Cannoll - 14 Years Ago
Edhy Rijo - 14 Years Ago
Ger Cannoll - 14 Years Ago
Edhy Rijo - 14 Years Ago
Ger Cannoll - 14 Years Ago
                         [quote][b]Gerard O Carroll (8/30/2011)[/b][hr]I have re-engineered my...
Edhy Rijo - 14 Years Ago
                             Hi Gerard, Looking at the DevExpress videos I came across to this one...
Edhy Rijo - 14 Years Ago
                                 Not sure this would help, but here is an Infragistics inherited Grid I...
Ivan George Borges - 14 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search