16.08.2017, 14:23 | #21 |
Участник
|
https://gist.github.com/mazzy-ax/4d4...7527623467aee8
X++: 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'); } } https://gist.github.com/mazzy-ax/292...fc753bfca9c529 Код: #Powershell $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') Последний раз редактировалось mazzy; 16.08.2017 в 14:41. |
|
|
За это сообщение автора поблагодарили: trud (5), gl00mie (5). |
Теги |
ax2012, ax7, модель |
|
|