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 ...
随机推荐
- leetcode 187. Repeated DNA Sequences 求重复的DNA串 ---------- java
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- 实现DevExpress GridControl 只有鼠标双击后才进行修改数据
1. 实现DevExpress GridControl 只有鼠标双击后才进行修改数据:修改GridView.OptionsBehavior.EditorShowMode属性为Click 2. 实现De ...
- python整理之(字符串、元组、列表、字典)
一.关于字符串的整理总结 对于字符串的操作常用的有这些: 字符串的操作通过dir()函数可以查看 我们先整理没有下划线的用法,有下划线的暂时不去考虑. 1.capitalize 功能:使字符串的首字母 ...
- 用Join子句进行分组联接
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- mybatis 与 日志
如上图所示,mybatis默认支持7种日志记录的方式,也可以自己实现Log接口,然后将实现类通过LogFactory注入到日志工厂中. LogFactory是日志模块的入口,外层通过getLog获取L ...
- node express 304 avoid
method 1 Why do I need this? The right answer is: I don’t need that trick! The example below is just ...
- Winfrom 开发小技能
1.放弃进度条.动态进度图片等方式实现用户体验优化方式(主要是优化用户等待体验),建议使用方式? 答:对于From或者Control而言,其提供了Cursor属性设置即可. 例如: this.Curs ...
- python---set集合
集合(set)是一个无序不重复元素的序列. #!/usr/bin/python3 student = ({'Tom', 'Jim', 'Mary', 'Tom', 'Jack', 'Rose'}) p ...
- MVC+EasyUI 菜单导航的实现
一个简单的使用mvc+easyUi 动态菜单显示 直接上代码 前端 function initMenu() { $.get("/Admin/Home/GetNav", functi ...
- Run Loop详解
Run loops是线程的基础架构部分.一个run loop就是一个事件处理循环,用来不停的调配工作以及处理输入事件.使用run loop的目的是使你的线程在有工作的时候工作,没有的时候休眠. Run ...