Passing BO as Parameter


Author
Message
Thomas Holste
Thomas Holste
Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)Advanced StrataFrame User (536 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

In my main project I have different BOs which I use. Now I am

trying something I can't get to work and need some advice.

I added a second project which will contain some classes which will be used in other projects too. Now I was wondering if I could pass a BO as a parameter to a class in this second project. For example:

Public class dogettitelsatz

Public Sub gogettitel(cTitel as string, oBO as ???)

...start searching for a specific record

End Sub

End Class

This class shall be instantiated in the main-project:

...Dim oTitel as new titelsatz

oTitel.dogettitel("1234567",gatitelBO1)

But I can't figure it out and I am asking myself, if this is just old VFP-habits and I should solve it any other way?

And I was wondering, if I would instantiate my "own" BO in the second-project, I could "use" the definition (Mapping) in my main-project and how this can be done?

Thanks a lot for your help

Thomas

Replies
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
Hi Thomas.

Try this:

Public Sub gogettitel(ByVal cTitel as String, ByVal oBO as MicroFour.StrataFrame.Business.BusinessLayer)


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 Thomas,



Adding to Ivan suggestion, keep in mind that if you have custom methods and properties in your BO, you need to CAST it to the correct type so you can see and use those custom methods/properties.





Public Sub gogettitel(ByVal cTitel as String, ByVal oBO as MicroFour.StrataFrame.Business.BusinessLayer)

Using MyNiceBO as CTYPE(oBO,gatitelBO)

' Now you can see your custom methods/properties. Make sure you have the class gatitelBO available in your project.

End Using

End Sub



Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Adding to both Ivan and Edhy BigGrin ....



If the gogettitel will only work with BOs of type gatitelBO, then you could just do this:



Public Sub gogettitel(ByVal cTitel as String, ByVal oBO as gatitelBO)




I.e. you can skip the cast.



If you intended the gogettitel method to work with multiple types, that is also possible, but a bit more complicated.
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