﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>CapableObjects Forums / ECO / General discussions  / I want to know have one class have associations with the class2 in code at run time? / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>CapableObjects Forums</description><link>http://www.capableobjects.com/apps/InstantForum414/</link><webMaster>forums@capableobjects.com</webMaster><lastBuildDate>Wed, 08 Feb 2012 22:33:45 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: I want to know have one class have associations with the class2 in code at run time?</title><link>http://www.capableobjects.com/apps/InstantForum414/Topic5030-4-1.aspx</link><description>Hi&lt;/P&gt;&lt;P&gt;Something like this - though I've not tested it&lt;/P&gt;&lt;P&gt;IEcoServiceProvider sp = MyEcoSpace or EcoServiceProvider&lt;BR&gt;ITypeSystemService ts = sp.GetEcoService&amp;lt;ITypeSystemService&amp;gt;();&lt;BR&gt;IClass class = ts.TypeSystem.AllClasses.GetItemByName("Class1");&lt;/P&gt;&lt;P&gt;foreach (IStructuralFeature sf in class.AllStructuralFeatures)&lt;BR&gt;{&lt;BR&gt; if (sf.FeatureType == FeatureType.AssociationEnd)&lt;BR&gt; {&lt;BR&gt;  if ((sf as IAssociationEnd).Type_.Name == "Class2")&lt;BR&gt;  {&lt;BR&gt;   //Code Here&lt;BR&gt;  }&lt;BR&gt; }&lt;BR&gt;}&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nick</description><pubDate>Mon, 22 Mar 2010 14:25:42 GMT</pubDate><dc:creator>nickcrisp</dc:creator></item><item><title>I want to know have one class have associations with the class2 in code at run time?</title><link>http://www.capableobjects.com/apps/InstantForum414/Topic5030-4-1.aspx</link><description>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.&lt;br&gt;thank you!</description><pubDate>Mon, 22 Mar 2010 10:17:20 GMT</pubDate><dc:creator>wangwei.njcn</dc:creator></item></channel></rss>
