最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

理解D365FO中包的概念 / Understanding Packages in D365FO

网络文摘 William 209浏览 0评论

Understanding Packages

The entire code base of AX 7 is built around Packages. It is very important for developers to have a clear understanding of this concept. We have discussed the directory structure of packages in the previous blog post. Generally speaking, a package is literally a package that contains all the necessary files for the deployment of a solution. It includes all of the models, binaries and additional pieces of code necessary for deployment.
If you want to perform customization using overlayering, you need to create a model in the same package as that of the customized object. Otherwise, it will throw errors and would not allow. And this makes sense, since when this solution would be moved this whole package would be deployed and therefore any customizations made using overlayering should be part of the same package.
Below is the screenshot of our directory folder. All the items you see are packages:
3
Application foundation is the package that has most of the standard code and is most likely to be overridden. I have done customization in the objects that are part of this package using overlayering. You can see from the figure below we have two custom models ‘AXPulse Dev’ and ‘AXPulse Custom’ added under the same package. So when this Application foundation package is deployed elsewhere, our changes will automatically go along with the custom models.
Packages in
If we open up the Application explorer in Visual studio, we can see all the objects similar to AOT.
How do you find the package and layer for an object? In the image below, you can see highlighted in green shows the package and highlighted in red shows the layer.
AOT

Overlayering and Extensions:

Developers can do development either by overlayering or extension. Overlayering is an old concept that was also present in previous versions of Dynamics AX. Extension is a new concept introduced with AX 7.

Overlayering

Dynamics AX is code base is based on layered architecture. There are different layers such as SYS, CUS, USR, etc. We can customize the default SYS level objects in USR, CUS, VAR, etc layers and make modifications in the class, form, reports, etc. This model was used in previous versions and is known as overlayering.
AX 7 also allows this but there are some differences now. As we know that, in AX 7 everything resides in a model and the model resides inside a package.
So let’s say you want to perform some customizations in the standard Sales table. To do that using the overlayering approach, you will need to create your model in the same package as that of Sales table. This is because there will be a dependency between your customization and the Sales table and both should reside in the same package. This is because when changes are moved, it’s actually the package that is deployed. Therefore, all overlayering changes must reside in the same package.
To customize an object using overlayering, simply right click the object and click customize. Your current model should reside in the same package as that of the customized object.
Customize

Extensions

Extension is a new concept introduced in AX 7. This allows you to extend the functionality of the existing objects without actually modifying the original code. This is especially helpful during upgrades. The developers are very much familiar what happens when a new cumulative update is installed on top of customized code base. We get a large number of conflicts and unexpected behaviors. Extensions come to the rescue as during extension your original object is unmodified rather a copy or an extension is created in which you make your changes.
Let us add a new field in the CustTable using extension. To do that, right click on CustTable and click ‘create extension in new project’. This will create a new project and will add CustTable.extension in there.
ext1
ext2
Now add a new field ‘AXPCustomerInfo’ in the table.
ext3
This is a simple demonstration of making modifications using the extension model.
Artice from AXpulse.com
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址