AIF Operation -- findKey()
来源:互联网 发布:单片机c语言数据类型 编辑:程序博客网 时间:2024/06/01 18:03
AIF 中的服务一般会提供八种操作, 分别为create,delete,find,findKeys,getKeys,read,update, getChangeKey
我们今天来讨论如何使用AIF Service 中的findKeys方法去读取 Dynamics AX中的数据
- 注册 SalesSalesOrderService 服务
- 创建一个NetTcp类型的端口,命名为TestAIFOperation,添加SalesSalesOrderService 服务的findKeys方法
- 在VS2010种创建一个console类型的项目
- 取得端口中的服务地址(WSDL URI): http://RD7145D0511:8101/DynamicsAx/Services/TestAIFOperation
- 添加引用,右击Reference/Add Service Reference,将WSDL URI复制进去,点击Go按钮,再点击确定
- 执行一下代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TestAIFFindKeyMethod.ServiceReference1;
namespace TestAIFFindKeyMethod
{
class Program
{
static void Main(string[] args)
{
string salesIdValue1 = "SO-101244";
string salesIdValue2 = "SO-101250";
SalesOrderServiceClient client = new SalesOrderServiceClient();
CallContext context = new CallContext();
context.Company = "CEU";
try
{
EntityKey[] entityKey = client.findKeys(context, createQueryCriteria(salesIdValue1,salesIdValue2));
foreach (EntityKey key in entityKey)
{
Console.WriteLine();
Console.WriteLine("Output result:");
KeyField[] fields = key.KeyData;
foreach (KeyField field in fields)
{
Console.WriteLine("Field: {0}", field.Field);
Console.WriteLine("Value: {0}", field.Value);
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
client.Close();
}
Console.ReadKey();
}
private static QueryCriteria createQueryCriteria(string salesIdValue1, string salesIdValue2)
{
CriteriaElement[] criteriaElements = new CriteriaElement[1];
criteriaElements[0] = new CriteriaElement();
criteriaElements[0].DataSourceName = "SalesTable";
criteriaElements[0].Operator = Operator.Range;
criteriaElements[0].FieldName = "SalesId";
criteriaElements[0].Value1 = salesIdValue1;
criteriaElements[0].Value2 = salesIdValue2;
QueryCriteria queryCriteria = new QueryCriteria();
queryCriteria.CriteriaElement = criteriaElements;
return queryCriteria;
}
}
}
- 运行,结果如下:
Output result:
Field: SalesId
Value: SO-101244
Output result:
Field: SalesId
Value: SO-101245
Output result:
Field: SalesId
Value: SO-101246
Output result:
Field: SalesId
Value: SO-101247
Output result:
Field: SalesId
Value: SO-101248
Output result:
Field: SalesId
Value: SO-101249
Output result:
Field: SalesId
Value: SO-101250
- AIF Operation -- findKey()
- AIF Operation -- Find()
- AIF Operation -- Read()
- AIF Operation -- Create()
- AIF Operation -- Delete()
- AIFF/AIF格式解析
- operation
- dbm数据库源代码分析(8):hash.c和findkey.c
- AIF创建文件图标的方法
- 位图编译说明以及生成AIF的注意点
- EDMA3模块及其在AIF接口中的应用
- Configure AIF service on Dynamics AX step by step
- Archlinux2013-07没有/arch/setup的AIF,新安装方式。
- Dynamics AX 2012 R2 AIF No Endpoint Behavior Named 'clientEndpointBehavior'
- Operation PRI
- Operation Password
- Database Operation
- Operation System
- 文件管理File类
- Dekker's algorithm
- 在虚拟机VirtualBox上安装Lion 10.7以及XCode
- Oracle] 如何解决ORA-04031 错误
- 初识GPIO
- AIF Operation -- findKey()
- ECLISPE的快捷键大全
- nova-compute的虚拟机创建调度策略
- linux下定时器的实现(select+线程)
- [面试] 在数组查找这样的数,它大于等于左侧所有数,小于等于右侧所有数
- AIF Operation -- Delete()
- 2013年2月7日 故障--都是数据库惹的祸
- 邻接矩阵与邻接表
- 2013互联网行业大会信息