I want to know have one class have associations with the class2 in code at run time?
 
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



I want to know have one class have... Expand / Collapse
Author
Message
Posted 2010-03-22 10:17:20
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 2010-06-22 11:37:01
Posts: 32, Visits: 193
As title; I have many classes , I want to know one class have association relationship with the class2? If have ,I will do some thing.
thank you!
Post #5030
Posted 2010-03-22 14:25:42
Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru

Group: Forum Members
Last Login: 2010-08-12 17:32:24
Posts: 51, Visits: 600
Hi

Something like this - though I've not tested it

IEcoServiceProvider sp = MyEcoSpace or EcoServiceProvider
ITypeSystemService ts = sp.GetEcoService<ITypeSystemService>();
IClass class = ts.TypeSystem.AllClasses.GetItemByName("Class1");

foreach (IStructuralFeature sf in class.AllStructuralFeatures)
{
 if (sf.FeatureType == FeatureType.AssociationEnd)
 {
  if ((sf as IAssociationEnd).Type_.Name == "Class2")
  {
   //Code Here
  }
 }
}

Regards

Nick

Post #5034
« 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

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 10:15

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0,391. 9 queries. Compression Disabled.