假设我需要- hosts: load-balancer-host
tasks:
- name: print debug message
debug:
msg: "this play is for gathering facts on the LB"
- name: A play
hosts: workers
tasks:
- name: Look for text pattern in delegated host
delegate_to: load-balancer-host
find:
paths: "{{ hostvars['load-balancer-host'].ansible_env.ENVIRONMENT_VARIABLE }}/subdir"
file_type: file
patterns: file.pattern
contains: 'text pattern'
register: aVariable
属于AOT objects
model
和Tables
Table Extensions
或treeNode
问题:如何从模型中获取AOT对象...
答案 0 :(得分:1)
X ++:https://gist.github.com/mazzy-ax/4d4d06ec2fddd885b67527623467aee8
class Tables
{
public static void Main(Args _args)
{
str aosServiceBin = 'C:\AOSService\webroot\bin';
str packageDir = 'C:\AOSService\PackagesLocalDirectory';
//or
var environment = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();
packageDir = environment.get_Aos().get_PackageDirectory();
// it's kind of magic
var runtimeProviderConfiguration = New Microsoft.Dynamics.AX.Metadata.Storage.Runtime.RuntimeProviderConfiguration(packageDir);
var metadataProviderFactory = New Microsoft.Dynamics.AX.Metadata.Storage.MetadataProviderFactory();
var provider = metadataProviderFactory.CreateRuntimeProvider(runtimeProviderConfiguration);
// object names
print provider.Tables.ListObjectsForModel('FleetManagement');
print provider.Tables.ListObjectsForModel('FleetManagementExtension');
print provider.TableExtensions.ListObjectsForModel('FleetManagement');
print provider.TableExtensions.ListObjectsForModel('FleetManagementExtension');
// single object by name
var custTransMetaData = provider.Tables.Read('CustTrans');
}
}
Powershell脚本:https://gist.github.com/mazzy-ax/292f2ce1a8e79c39d1fc753bfca9c529
$aosServiceBin = 'C:\AOSService\webroot\bin'
$packageDir = 'C:\AOSService\PackagesLocalDirectory'
# or
add-type -path (Join-Path $aosServiceBin 'Microsoft.Dynamics.ApplicationPlatform.Environment.dll')
$environment = [Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory]::GetApplicationEnvironment()
$packageDir = $environment.get_Aos().get_PackageDirectory()
# it's kind of magic
add-type -path (Join-Path $aosServiceBin 'Microsoft.Dynamics.Ax.Metadata.Storage.dll')
$runtimeProviderConfiguration = New-Object Microsoft.Dynamics.AX.Metadata.Storage.Runtime.RuntimeProviderConfiguration $packageDir
$metadataProviderFactory = New-Object Microsoft.Dynamics.AX.Metadata.Storage.MetadataProviderFactory
$provider = $metadataProviderFactory.CreateRuntimeProvider($runtimeProviderConfiguration)
# object names
$provider.Tables.ListObjectsForModel('FleetManagement').count
$provider.Tables.ListObjectsForModel('FleetManagementExtension').count
$provider.TableExtensions.ListObjectsForModel('FleetManagement').count
$provider.TableExtensions.ListObjectsForModel('FleetManagementExtension').count
# single object by name
$provider.Tables.Read('CustTrans')
C#,T-SQL可以在他自己的图像中创建。