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 ...
随机推荐
- css实现分割线
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>& ...
- (zhuan) Deep Reinforcement Learning Papers
Deep Reinforcement Learning Papers A list of recent papers regarding deep reinforcement learning. Th ...
- Python之路,day7-Python基础
os.system 输出命令结果到屏幕,返回命令执行状态os.popen("dir").read()#会保存命令的执行结果输出py2.7commandscommands.getst ...
- 移动支持 – ASP.NET MVC 4 系列
目前,有各种各样的方法可以提高网站应用程序的移动体验.在某些情况下,我们只想在小规格上做一些微小的风格变化:另一些情况下,我们可能完全改变外观显示或者一些视图的内容:最极端的情况下,我们 ...
- 嵌入式系统添加无线wifi模块
开发环境:fl2440开发板,linux3.0内核,交叉编译器路径/opt/buildroot-2011.11/arm920t/usr/bin/arm-linux-,无线网卡RT3070 平时开发板联 ...
- maven-deploy失败
昨天遇到的问题,mavne项目执行deploy的时候,出错.提示 Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1] 很直白 ...
- Ubuntu14.04+Beanstalkd1.9最佳实践
目录 [TOC] 1.基本概念 1.1.什么是Beanstalkd? Beanstalkd 是一个轻量级消息中间件,它最大特点是将自己定位为基于管道 (tube) 和任务 (job) 的工作队列. ...
- PHP eof的使用
PHP eof的使用 也就是heredoc技术,来部分实现界面与代码的分离 <?php $name = '张三'; print <<<EOT <html> < ...
- ubuntu下sublime中文无法输入的问题
感谢- http://www.cnblogs.com/ningvsban/p/4346766.html
- 学习taobao框架
参考:https://github.com/xulingbo/xulingbo.github.io/issues http://blog.csdn.net/hguisu/article/details ...