Book a Demo

Author Topic: Code Generate of Collection Classes  (Read 2372 times)

mover

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Code Generate of Collection Classes
« on: June 23, 2003, 04:07:05 pm »
I'm trying to model a system where the main class will contain a collection as one of its properties. Here's the scenario:

I have 3 classes - Book, Authors & Author
 - Author contains properties that describe an individual author.
 - Authors is a collection of Author objects.
 - Book contains a property of type Authors.

I'm having trouble modelling this and getting the code (VB.NET) to come out as I expect. It's probably because I'm a relative newbie to UML and modelling :(

I've played around with the collections settings and the aggregation link between Author and Authors and generally get nothing having to do with a collection. I did get an attribute named m_Author of type CollectionBase once (and I forget how I managed that!)

What I was expecting was something along the lines of:

-------------< cut>-------------
Public Class Authors
   Inherits System.Collections.CollectionBase
   Public ReadOnly Property theAuthor(ByVal index As Integer) As Author
   Get
     Return (CType(list.Item(index), Author))
   End Get
 End Property
End Class

-------------< cut>-------------

Can anyone give me a hint as to what I might be doing wrong?

Thanks a lot!

Mover