473,657 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extending Business Object

All,
I have an existing business object (VB.Net) which returns user IDs for our
locations in our regions.
One of the properties objReg.Manager returns the manager's user id (integer)
for a given location.

What I'd like to do is implement something similar to .ToString, so I might
call -
objReg.Manager. GetUser()
This would return a User object (which we already have written) representing
the Manager for that ID.
(There's also VP, Director, etc properties.. so this code would be used for
those properties as well)

We already have a objReg.GetManag er property which does this, but I think it
would just be snazzier to implement it in the method above.

Does anyone know how I might pull this off -- or even what I would search
for to get me started?
TIA
Brandon.
Jan 11 '06 #1
4 1196
Brandon Miller wrote:
All,
I have an existing business object (VB.Net) which returns user IDs for our
locations in our regions.
One of the properties objReg.Manager returns the manager's user id (integer)
for a given location.

What I'd like to do is implement something similar to .ToString, so I might
call -
objReg.Manager. GetUser()
This would return a User object (which we already have written) representing
the Manager for that ID.
(There's also VP, Director, etc properties.. so this code would be used for
those properties as well)

We already have a objReg.GetManag er property which does this, but I think it
would just be snazzier to implement it in the method above.

Does anyone know how I might pull this off -- or even what I would search
for to get me started?
TIA
Brandon.


I may have missed something on what you are looking to do. If you have
the GetManager method that returns the object, what are you looking for
help on?

Chris
Jan 11 '06 #2
Sorry.. I figured I wasn't explaining myself well.
Rather than have a separate method for each of the positions, (VP, Manager,
Director, AsstManager, etc)
I'd like to have a method at the end of each of those properties which
returns the User object for that account ID.
.VP.GetUser()
.Manager.GetUse r()
.Director.GetUs er()
.AsstManager.Ge tUser()

The guts of GetUser will be the same for any of those properties.
I just don't know how to make GetUser hook into the existing properties.
I think it would be easier to maintain, more intuitive and of course,
intellisense would kick in, making coding faster. :)

Thanks,
"Chris" <no@spam.com> wrote in message
news:uB******** ******@tk2msftn gp13.phx.gbl...
Brandon Miller wrote:
All,
I have an existing business object (VB.Net) which returns user IDs for
our locations in our regions.
One of the properties objReg.Manager returns the manager's user id
(integer) for a given location.

What I'd like to do is implement something similar to .ToString, so I
might call -
objReg.Manager. GetUser()
This would return a User object (which we already have written)
representing the Manager for that ID.
(There's also VP, Director, etc properties.. so this code would be used
for those properties as well)

We already have a objReg.GetManag er property which does this, but I think
it would just be snazzier to implement it in the method above.

Does anyone know how I might pull this off -- or even what I would search
for to get me started?
TIA
Brandon.


I may have missed something on what you are looking to do. If you have
the GetManager method that returns the object, what are you looking for
help on?

Chris

Jan 11 '06 #3


I'm a bit confused about the ToString() reference but the problem as I
understand it is
You have a business object which includes the 4 methods

Function VP() as Integer
Function Manager() as Integer
Function Director() as Integer
Function AsstManager() as Integer

where the integer is a userID.

You wish to be able to obtain more details about the user (basically a
User object)
You cannot just use a x.VP.GetUser() with extending the Integer type
(inherit something from Integer and include a GetUser() function). This
starts off as a dodgy idea and gets worse very quickly (how does this
new type (IntegerX ?) know how to look up a user?

Conceptually cleanest but it depends on the implementation of your
existing business object and how much you can change it, is to change
the existing functions to

Function VP() as User
Function Manager() as User
Function Director() as User
Function AsstManager() as User

where one of the properties on the User is ID() as integer

You then replace all references to .VP or .Manager with .VP.ID or
..Manager.ID, and so on.
If you cannot change the existing business object then you are back to
a more procedural shape of creating a function that takes a UserID and
returns a user object.

If the code for getting the user given the user ID is different for
each user type, well then it depends on how different.
Very different, then you are probably stuck with different functions
for each.
Mostly the same but with some small changes - you can create a class
to encapulate the general functionality which has overridable methods
for the specific sections.

Without more details it is hard to be more specific.
Best bet - if you can change the business object that is returning the
user ids to return users instead then I would go with that one.

hth,
Alan.

Jan 11 '06 #4
Thanks for the info Alan.
I'll be leaving well enough alone. :)
Regards,

<al*******@user s.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .


I'm a bit confused about the ToString() reference but the problem as I
understand it is
You have a business object which includes the 4 methods

Function VP() as Integer
Function Manager() as Integer
Function Director() as Integer
Function AsstManager() as Integer

where the integer is a userID.

You wish to be able to obtain more details about the user (basically a
User object)
You cannot just use a x.VP.GetUser() with extending the Integer type
(inherit something from Integer and include a GetUser() function). This
starts off as a dodgy idea and gets worse very quickly (how does this
new type (IntegerX ?) know how to look up a user?

Conceptually cleanest but it depends on the implementation of your
existing business object and how much you can change it, is to change
the existing functions to

Function VP() as User
Function Manager() as User
Function Director() as User
Function AsstManager() as User

where one of the properties on the User is ID() as integer

You then replace all references to .VP or .Manager with .VP.ID or
.Manager.ID, and so on.
If you cannot change the existing business object then you are back to
a more procedural shape of creating a function that takes a UserID and
returns a user object.

If the code for getting the user given the user ID is different for
each user type, well then it depends on how different.
Very different, then you are probably stuck with different functions
for each.
Mostly the same but with some small changes - you can create a class
to encapulate the general functionality which has overridable methods
for the specific sections.

Without more details it is hard to be more specific.
Best bet - if you can change the business object that is returning the
user ids to return users instead then I would go with that one.

hth,
Alan.

Jan 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5890
by: Casper B | last post by:
Since I am only able to pass simple beans around using my Web Service framework, I wonder how to incorporate business logic around these beans. My idea was to let my Beans be the base class and simply extend these with more sophisticated classes with the nessesary business logic inside. However, when I do a cast from MyObjectBean to MyObject I get a ClassCastException. Is it not possible to cast in this direction? public class...
75
3862
by: David MacQuigg | last post by:
Seems like we need a simple way to extend Python syntax that doesn't break existing syntax or clash with any other syntax in Python, is easy to type, easy to read, and is clearly distinct from the "base" syntax. Seems like we could put the @ symbol to good use in these situations. Examples: print @(separator = None) x, y, z @x,y:x*x+y*y -- anonymous function
17
3613
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels deep. In that case you need much more ram than a PC has to store functions calculated in loops so that you do not have to recalculate every time you cycle through the nest of loops. Using a HD for storage to extend ram is much too slow for many...
15
3675
by: Tim Jarvis | last post by:
Hi, I have an object that I am binding to a text box, this object exposes a boolean field, and I have implemented a format event handler and a parse event handler for the binding object, where I convert the bool value to some meaningful text. i.e. Binding b = new
3
2224
by: Flip | last post by:
I'm looking at the O'Reilly Programming C# book and I have a question about extending and combining interfaces syntax. It just looks a bit odd to me, the two syntaxes look identical, but how does C# know which is extending and which is combining? interface IStorable{ void Read(); void Write(object o); }
7
1633
by: A Traveler | last post by:
Hello all, i was just curious if anyone whos been playing with VS2005 could tell me... In javascript (and java??) you can alter the prototypes for an object in your project. I dont remember the syntax exactly, but basically you do something like: function String.prototype.mySplit(myArgs){...do something...}
4
2266
by: Ian Richardson | last post by:
Hi, The function I've put together below is a rough idea to extend a SELECT list, starting from: <body> <form name="bambam"> <select id="fred"> <option value="1">1</option> <option value="2">2</option>
1
1619
by: Tom C | last post by:
Hi all, In an N-tier app, what is the DOT NET approach for extending an application at all levels (i.e. DAL, Business Object, Client) for a customer or module specific deviation without changing the base code. Inheritance does not seem to be the answer here as the core application could/should be the same for all customers. Does extensibility play a role here? Events? How do I add a class to a namespace in a separate dll that my...
0
2106
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via callback.setHandler1(callback1) this only seems to affect pythons ability to trigger an "event" in c. PyObject *Handler is always NULL even after I call Register_Handler(...). I thought there was some magic here that was assigning the pointer *Handler to my python...
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.