11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

amrameshreddy.blog.com304 CHAPTER 10 ■ INTEGRATING WITH COM+ramrameshreddy.blog.comThe PositionManagement interface shown in Listing 10-1 provides a set of simple methodsthat allow the retrieval of the position for a given ticker, in addition to providing a method forupdating the persisted quantity associated with a ticker. 4 One element that is not shown is aconstructor. COM+ objects don’t offer a constructor. They can provide information in otherways, such as with an initialization method. Visual Basic 6 and COM offer several ways ofproviding static configuration information such as COM+ initialization strings on the configuredcomponent; however, that requires implementing IObjectConstructString in VisualBasic 6 and using the ConstructionEnable attribute in .NET. For the example code and to keepit simple, we’re just showing method interfaces. The ability to provide a connection string onobject construction is something that could be provided through COM+ initialization.Listing 10-1. PositionManagement.cls'Simple interface that allows a nominal change in the quantity of a position'ticker: Ticker symbol of security'quantity: Amount (+/-) to shift existing position'Throws an error if quantity is not sufficient to support the change (overdrawn)Public Function UpdatePosition(ByVal Ticker As String, _ByVal Quantity As Long) As Long...Public Function GetQuantity(ByVal Ticker As String) As Long...The second component is the Position component. This class represents mostly a dataclass with read/write properties. In addition, it has two methods; one provides a retrieval of aspecific position for a ticker, and the other returns a concrete Position object for a specificticker. Listing 10-2 shows the abbreviated class, and the full class is part of the chapter code in\OldHorsePositionTracking\VB6\PositionManagement.Listing 10-2. Visual Basic 6 Position Class: Position.clsPublic Property Let Quantity(ByVal vData As Long)...Public Property Get Quantity() As Long...Public Property Let Ticker(ByVal vData As String)...Public Property Get Ticker() As String...Public Function GetQuantity(ByVal Ticker As String) As Long...Public Function GetPosition(ByVal Ticker As String) As Position...ramrameshreddyramrameshreddy4. Note these are simplified interfaces for example purposes only and do not represent a proper interfacedefinition for a fully functional custody system.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!