I am embarrased to ask this question. I know it should be simple but I have spent hours trying to figure out the way to do this.
I have the following BOs:
Meeting
AgendaItems
AgendaItem
Agenda Items is a child collection property of meeting. Of course, this collection has objects of type AgendaItem. So Meeting-->AgendaItems-->AgendaItem (a collection of them of course).
Assuming all the BOs are properly implemented. (An assumption I am definitely willing to visit).
I have written UnitTests to test the meeting BO. It works fine test for all CRUD in the BO. So I added the AgendaItems/AgendaItem in the last few days. I went to mod my unitTests with code like this:
dim meeting as Meeting
meeting= Meeting.NewMeeting
...set biz properties .
Then do
If meeting.IsSavable then meeting=meeting.Save
All that works fine. So I tried to add the following to my unit test:
dim ai as agendaItem=meeting.AgendaItems.AddNew. This fails on compile sayinig that no constructor can be found.
So this raises the simple question for me. How do I create a new AgendaItem into my AgendaItems collection using the meeting object. In other words...I want to add an agendaItem to the meeting. What syntax will work. I looked for hours in the book and online and could not find a clear example.
I know this is a way noobie question. Just trying to learn this stuff.
Seth Spearman
ajj,
Thanks for your post. That did the trick. I had the code in my object class but did not think I needed it. When I uncommented that out then it worked like a charm.
As I looked over the biz obj Book I realize that Rocky also said that the collection private construction should have AllowNew=True. When do you use that? My code worked without it.
Seth
Copyright (c) Marimer LLC