Book a Demo

Author Topic: C# Code Import Doesn't Resolve Local Instances  (Read 3451 times)

Peter Gluck

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
C# Code Import Doesn't Resolve Local Instances
« on: December 11, 2010, 12:38:59 pm »
When importing C# source code, I've noticed that some dependencies don't get created by EA.  I created a simple project to demonstrate the issue.  When I import the source code into EA, it correctly resolves the following relationships:
    [*]Inheritance (including interfaces)
    [*]Composition (as associations)
    [*]Dependencies on method arguments
    [*]Dependencies on method return types
    [/list]

    Dependencies on method local instances (i.e., using the 'new' operator), however, are NOT created.

    Below is source code that demonstrates the problem.  When EA imports the code, the "Detached" class is not connected to the "ISimple" interface even though there is a real dependency (and indeed "Detached" won't compile without the reference).

    I've searched the documentation and options but I have not found a way to get EA to recognize dependencies on local instances.  Am I missing something?

    Peter

    Code: [Select]
    namespace Simple {
          interface ISimple {
                void Foo();
          }
    }

    namespace Simple {
          class Simple: ISimple {
                public void Foo() {
                }
          }
    }
    namespace Simple {
          class Factory {
                public ISimple GetSimple() {
                      return new Simple();
                }
          }
    }

    namespace Simple {
          class Client {
                public void Bar(ISimple simple) {
                      simple.Foo();
                }
          }
    }

    namespace Simple {
          class Composed {
                public ISimple Simple;
          }
    }

    namespace Simple {

          class Detached {
                public void Bar() {
                      ISimple simple = new Simple();
                      simple.Foo();
                  }
          }
    }


    Eve

    • EA Administrator
    • EA Guru
    • *****
    • Posts: 8110
    • Karma: +119/-20
      • View Profile
    Re: C# Code Import Doesn't Resolve Local Instances
    « Reply #1 on: December 13, 2010, 08:23:21 am »
    Correct. EA doesn't process the method bodies at all.

    Peter Gluck

    • EA Novice
    • *
    • Posts: 3
    • Karma: +0/-0
      • View Profile
    Re: C# Code Import Doesn't Resolve Local Instances
    « Reply #2 on: December 14, 2010, 04:57:41 am »
    Thank you.  Are there any plans to include this capability?  I think simply parsing the 'new' keyword would do it.  

    Regards, Peter
    « Last Edit: December 14, 2010, 05:31:05 am by pgluck »

    Eve

    • EA Administrator
    • EA Guru
    • *****
    • Posts: 8110
    • Karma: +119/-20
      • View Profile
    Re: C# Code Import Doesn't Resolve Local Instances
    « Reply #3 on: December 14, 2010, 08:29:35 am »
    No short term plans at least.