AX7: HOW TO USE TABLE METHOD EXTENSION CLASS
To create new methods on a table without customize you should use the Table method extension class. This class will be compiled as an extension of the original table and the methods will be serialized to be included as part of the table methods.
First create a new class like below. Use the name pattern “YourClassName” + “_Extension“. On the example I will use the SalesLine table.
|
1
2
3
4
|
public static class MySalesLine_Extension{} |
Create your method always as Public Static and the first parameter should always be the table (It’s by this parameter and the “_Extension” that the builder will understand that the class is a “method extension class”). After that you can provide your parameters as you normally do and you can use when you gonna call the method.
|
1
2
3
4
5
6
7
|
public static class MySalesLine_Extension{ public static void initSalesLineCustom(SalesLine _this) { _this.ReceiptDateRequested = today(); }} |
After build your project and sync your database, this new method will be available to be used as part of the SalesLine table.
|
1
2
3
4
5
|
SalesLine salesLine;select firstonly salesLine;salesLine.initSalesLineCustom(); |
Important:
- Display methods doesn’t work on class extension.
- Static methods like “Find” that we used on AX2012 will be normal table methods now, so you need to declare the variable for the table and use the “find” as a normal method. Example:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
public static class MySalesLine_Extension{ public static SalesLine findByRecId(SalesLine _this, RecId _recId, boolean _forupdate = false) { SalesLine salesLine; if (_forupdate) { salesLine.selectForUpdate(_forupdate); } select firstonly salesLine where salesLine.RecId == _recId; return salesLine; }} |
And use the find like on the code below:
|
1
2
3
|
SalesLine salesLine;salesLine = salesLine.findByRecId(salesLineRecId); |
AX7: HOW TO USE TABLE METHOD EXTENSION CLASS的更多相关文章
- Extension Method[下篇]
四.Extension Method的本质 通过上面一节的介绍,我们知道了在C#中如何去定义一个Extension Method:它是定义在一个Static class中的.第一个Parameter标 ...
- Creating a settings table that can handle almost any type of value
Update: Updated article here. Today I wanted to be able to have a table store any type of value as a ...
- BitHacks
备份文件时看到的.我以前居然下过这东西. 2016-12-4 12:05:52更新 纯文本格式真棒.假如使用word写的我能拷过来格式还不乱?? Markdown真好. Bit Hacks By Se ...
- Bit Twiddling Hacks
http://graphics.stanford.edu/~seander/bithacks.html Bit Twiddling Hacks By Sean Eron Andersonseander ...
- PA教材提纲 TAW12-1
Unit1 Introduction to Object-Oriented Programming(面向对象编程介绍) 1.1 Explaining the Object-Oriented Progr ...
- RFC-RTSP
Network Working Group H. Schulzrinne Request for Comments: 2326 Columbia U. Category: Standards Trac ...
- Dapper 的输出参数使用示范
-- 普通SQL 示范-- Queries with output parameters. Hide Shrink Copy Code // output parameters // the para ...
- 自己打断点走的struts流程&拦截器工作原理
①. 请求发送给 StrutsPrepareAndExecuteFilter ②. StrutsPrepareAndExecuteFilter 判定该请求是否是一个 Struts2 请 求(Actio ...
- HEC-ResSim原文档
HEC-ResSim Reservoir System Simulation User's Manual Version 3.1 May 201 ...
随机推荐
- 高级Linux SA需要会做的事情
高级Linux SA需要会做的事情:linux---------系统安装(光盘或自动化安装)linux---------系统常用工具安装(sudo,ntp,yum,rsync,lrzsz syssta ...
- 【阿迪达斯 ZX850 系列】
[阿迪达斯zx850系列 灰蓝桔 36-44] [阿迪达斯 ZX850 新配色B34720 情侣鞋 36-44] [阿迪达斯 ZX850 新配色B34720 情侣鞋 36-44] [阿迪达斯 ZX85 ...
- Bridge.NET
块作用域闭包问题 结果正确:1 容易引入JSB:1 public class Program { static List<Action> createActions() { List< ...
- Spring集成jedis支持Redis3.0集群
接着上一节,我们通过spring FactoryBean实现redis 3.0集群JedisCluster与spring集成. http://www.linuxidc.com/Linux/2016- ...
- HYPER V 文件共享 复制文件 共享硬盘 来宾服务
虚拟机的设置 --> 集成服务 –> 来宾服务 勾选 文件就可以在本地机器和虚拟机上来回复制了. 他可让 Hyper-V 管理员在运行虚拟机的同时将文件复制到虚拟机,且无需使 ...
- 原生js事件委托
var commontop = document.getElementById("commontop");commontop.onclick = function(ev){ v ...
- openjudge-膨胀的木棍
http://noi.openjudge.cn/ch0111/09/ 总时间限制: 1000ms 内存限制: 65536kB 描述 当长度为L的一根细木棍的温度升高n度,它会膨胀到新的长度L'=(1 ...
- 为什么上传文件的表单里面要加一个属性enctype=multipart/form-data?
首先知道enctype这个属性管理的是表单的MIME编码.共有三个值可选:1.application/x-www-form-urlencoded2.multipart/form-data3.text/ ...
- 提供VR定制开发、AR定制开发(VR游戏定制、应用定制)
设置输出路径 添加烘培输出的贴图类型 添加“LightingMap”类型 设置烘培贴图大小和目标贴图位置为“自发光” 设置烘培材质,选择“输出到源” 点击“渲染”即可 24.标准材质贴图的烘培光影处理 ...
- [Maven]修改Maven的本地仓库路径
安装Maven后我们会在用户目录下发现.m2 文件夹.默认情况下,该文件夹下放置了Maven本地仓库.m2/repository.所有的Maven构件(artifact)都被存储到该仓库中,以方便重用 ...