Показать сообщение отдельно
Старый 19.12.2015, 16:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,491 / 846 (79) +++++++
Регистрация: 28.10.2006
mfp: X++ in AX7: Method signatures
Источник: http://blogs.msdn.com/b/mfp/archive/...ignatures.aspx
==============


This post is about one of the more subtle changes in AX7. AX7 uses the .NET runtime, aka CLR. This has some implications for method signatures. In the CLR a method's signature includes casing, parameters and return type. In AX2012 a method's signature was simply the method's name – case insensitive.

Why is this important? If you change a method's signature, then all references to the method needs to be recompiled. Including those changes that appear harmless, like:
  • Fixing a casing issue in a method name, e.g. "somemethod" -> "someMethod".
  • Changing return type from void to
Here is an example, where I changed the casing of a method, that is being consumed by a test. I did NOT recompile the test before running it.

Notice the System.MissingMethodException: Method not found: 'Void Dynamics.AX.Application.MyClass.myMethod()'. The CLR only knows of a method with all lower case.



Optional parameters
It is still safe to add and remove (unused) optional parameters. The X++ compiler uses CLR's method overloading, i.e. several methods with the same name and the variations of supported parameters are produced by the compiler.

Lesson to learn
Do not change a method's signature, unless you are willing (and able) to recompile all consumers.



THIS POST APPLIES TO MICROSOFT DYNAMICS AX7 TECHNICAL PREVIEW; IS PROVIDED AS-IS AND CONFERS NO RIGHTS.




==============
Источник: http://blogs.msdn.com/b/mfp/archive/...ignatures.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.