Derived associations between two classes each defined in different packages
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Derived associations between two classes each... Expand / Collapse
Author
Message
Posted 2010-05-25 00:29:51
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-11-18 23:48:32
Posts: 139, Visits: 410
I am trying to add a derived association between two classes that are each defined in different packages.  For example lets say I have two packages called Package A and Package B.  Package A has a class A and Package B has a class B.  In a class diagram for package B I pull in the Class A from Package A. 

So I have both classes in the same diagram.  I can add persistent associations just fine.  The extension method works as desired.  The problem I'm having is with derived associations.  I cannot get them to work.  My latest attempt gives an error in the extender code:


private static void EnsureMemberIndex(Vco.PartyPackage.Application obj) {
    if ((memberIndex == -1)) {
        memberIndex = OtherEndExtenderHelper.GetMemberIndexOfOtherEnd(obj, typeof(Vco.ProductPackage.Product), Vco.ProductPackage.Product.Eco_LoopbackIndices.Application2);
    }
}

I get an "Object reference not set to an instance of an object" error when OtherEndExtenderHelper.GetMemberIndexOfOtherEnd is called.

Has anyone got a derived association between two packages to work?

Thanks,

Brian

Post #5242
Posted 2010-05-25 11:29:16
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-07-14 17:05:00
Posts: 290, Visits: 2 617
brian (2010-05-25)
I am trying to add a derivedassociation between two classes that are each defined in different packages. For example lets say I have two packages calledPackage A and Package B.Package A has aclassA and Package B has a class B. In a class diagram for package B I pull in the Class A from Package A.

So I have both classes in the same diagram. I can add persistent associations just fine. The extension methodworks as desired. The problem I'm having is with derived associations. I cannot get them to work. My latest attempt gives an error in the extender code:


private static void EnsureMemberIndex(Vco.PartyPackage.Application obj) {
if ((memberIndex == -1)) {
memberIndex = OtherEndExtenderHelper.GetMemberIndexOfOtherEnd(obj,typeof(Vco.ProductPackage.Product), Vco.ProductPackage.Product.Eco_LoopbackIndices.Application2);
}
}



I get an "Object reference not set to an instance of an object" error when OtherEndExtenderHelper.GetMemberIndexOfOtherEnd is called.

Has anyone got a derived association between two packages to work?

Thanks,

Brian


Can you reproduce it in a simple app and post it somewhere?


====
Pete
Post #5244
Posted 2010-05-27 22:40:46
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-11-18 23:48:32
Posts: 139, Visits: 410
It was a lot of work but I had success.  I created a sample app that demonstrates the problem along with a couple of other issues.  I created a Maintis Bug report.  Here is a link to that:  http://magpie.no-ip.com/mantis/view.php?id=908

The bug report details things and has the sample app attached.

I just want to add that I love the concept of using extension methods to access associations from classes that know nothing of the class on the other end.  It really provides a nice way to break models up into reusable modules.  I can't wait until Microsoft finally implements extension propterties.  My fingers are crossed for .NET 5.

Brian

Post #5248
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 9:26

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,234. 12 queries. Compression Disabled.