Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Calling into .NET from AX7 - Is Polymorphism supported?

Posted on by Microsoft Employee

Hi, 

I have the following problem that I don't really understand. I have an event hook on the CustTable, which calls into a .NET class

[DataEventHandler(tableStr(CustTable), DataEventType::Updated)]
public static void CustTable_onUpdated(Common sender, DataEventArgs e)

{

   CustTable ct = sender as CustTable;
   var dispatcher = new Caller.Dispatcher();
   dispatcher.Call(ct);

}


My .NET class has the following method

public string Call(Dynamics.AX.Application.CustTable cTable)

{
...
}

However, the compiler complains

Severity Code Description Project File Line Suppression State
Error Method 'Call(System.Object)' is not found on type 'Caller.Dispatcher'. ......

However, if I used this signature;

public string Call(Microsoft.Dynamics.Ax.Xpp.Common cTable)
{
...
}

It doesn't complain. If I have both methods, it will still call the Base (Common) one, rather than the CustTable method. 

Can anyone shed some light on this?

Thanks, Jason

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Calling into .NET from AX7 - Is Polymorphism supported?

    Excellent, many thanks for the help!

  • Joris dG Profile Picture
    Joris dG 17,775 on at
    RE: Calling into .NET from AX7 - Is Polymorphism supported?

    I'm certain this basic scenario of passing CustTable to a C# method accepting CustTable worked at some point, but trying it now it seems like indeed that doesn't compile, I'm seeing the same issue. I'm following up with the compiler team here and will update you when I get an answer.

    On your question on polymorphism, I think I understand what you are asking but I think it's the same issue... if the compiler somehow considers common and CustTable as different types altogether, then that could lead to other issues. Speculation, let's fix the first issue first.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans