Subcalssing SF Business Objects


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The error you are getting is likely because your base class and derived class don't have matching constructors.  I.e. the following will bomb:

public class BaseBusinessLayer : MicroFour.StrataFrame.Business.BusinessLayer
{
    //-- Default, no argument constructor inferred
}

public class DerivedBO : BaseBusinessLayer
{
    //-- Oops, what constructor of base class is to be called here?
    //    There is no constructor in BaseBusinessLayer with two constructors.
    public DerivedBO (int index, int companyID) {}
}


All you need to do is explicitly call the correct constructor of the base class:

public class DerivedBO : BaseBusinessLayer
{
    //-- Explicitly call desired constructor of base class.
    public DerivedBO (int index, int companyID)
        : BaseBusinessLayer()
    {}
}


Also, BusinessLayer (and sub-classes of it) isn't really meant to be directly instantiated. They define an interface for common data and functionality for actual BOs (i.e. BOs built via the BO mapper).  There are lots of methods/properties that will through NotImplemented exceptions if just left as-is.
Edited 14 Years Ago by Greg McGuffey
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 Terry

I have had another look at the artcile and it seems to concentrate on Subclassing a specific BuisnessObject that was created in an application.

All I want to do is subclass the StrataFrame BusinesObject Class so I can insert my own specific code wherever required

Perhaps someone from SF might jump in
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
That is exactly the one it is. So no need to send it.
Sorry.
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 Terry.

Yes, Please email it.

Not sure if its the same one as an article on the LesPinter.com about Subclassing in general. I found that helpful for subclassing the standard controls, and there is also a section in there about subclassing BusinessObjects. I started reading it, but it seemd to be extremely complicated and went on to a few pages.... I was expecting it to take one or two lines to subclass.. but perhaps I am wrong , so I decided to post here in the hope that there is a simple way of subclassing Business Objects .... I presume most people subclass BUisness Objects as it is supposed to be best practise.
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I have a copy if you want me to email it too you?
Terry Bottorff
Sam Tenney
Sam Tenney
StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)StrataFrame User (140 reputation)
Group: StrataFrame Users
Posts: 70, Visits: 3.5K
Hi Gerard,

There used to be an article available from this website named "Subclassing Business Objects" written by Les Pinter, but I cannot find it now.  It might help you if somebody can find it.

I wish I could help you directly, but I am still a novice.  I only remember that the procedure was not at all what I expected.  I'm sure somebody from StrataFrame will help you soon.

Sam Tenney
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 start subclassing SF Buisness Objects (so I can imbed ny own Code in some of the methods)  and am not sure how to do this. I have successfully subclassed a few controls (TextBoxes, Lables) etc and they are working fine, so I am using a similar approcah for Buisness Objects.

I tried :  

public class KernelBO : MicroFour.StrataFrame.Business.BusinessLayer
{
}
My project compiles ok. I then created a new Business Object in the normal way , and went in manually and changed the generated code

from:
public partial class SquBO : MicroFour.StrataFrame.Business.BusinessLayer
to:
public partial class SquBO : KernelBaseSF.KernelBO


but got an error in compiling the Business Objects Project (KernelBaseSF.KernelBO does not contain a constructor that takes 2 arguments

What am I doing wrong here ?

 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search