3

私はこのコードを持っています:

foreach (PluginAssembly tempPluginAssembly in pluginAssemblyList)
            {
                if (!tempPluginAssembly.Name.StartsWith("Microsoft.Crm"))
                {
                    List<PluginType> pluginList;
                    pluginList = xrmContext.PluginTypeSet.Where(Plugin => Plugin.PluginAssemblyId.Id == tempPluginAssembly.Id).ToList();

                    foreach (PluginType plugin in pluginList)
                    {
                        if (plugin.IsWorkflowActivity == false)
                        {
                            writer.WriteLine(new string[] { tempPluginAssembly.Name, tempPluginAssembly.Description, plugin.Name, String.Empty });
                            ++pluginCount;
                        }
                    }
                }
            }

基本的には、crm 環境からアセンブリ リストを取得し、Microsoft アセンブリをフィルター処理します。次に、それらのアセンブリに含まれるすべての PluginType オブジェクトを取得し、その情報をどこかに記録します。しかし、これだけでは不十分です。各 PluginType オブジェクトに含まれるステップを取得したいと考えています。

どうすればそれを管理できますか?知らないクラスや、知らない PluginType オブジェクトの属性はありますか?

4

1 に答える 1

2

SdkMessageProcessingStepプラグイン ステップを取得するには、エンティティを参照する必要があります。以下のコードで、クエリの結合を確認できます。

foreach (PluginAssembly tempPluginAssembly in pluginAssemblyList)
{
    if (!tempPluginAssembly.Name.StartsWith("Microsoft.Crm"))
    {
        var pluginList = from plugins in xrmContext.PluginTypeSet
                         join steps in xrmContext.SdkMessageProcessingStepSet on plugins.PluginTypeId equals steps.PluginTypeId.Id
                         where plugins.PluginAssemblyId.Id == tempPluginAssembly.Id
                         select new
                         {
                             plugins,
                             steps
                         };


        //_XrmContext.PluginTypeSet.Where(Plugin => Plugin.PluginAssemblyId.Id == tempPluginAssembly.Id).ToList();

        foreach (var plugin_step in pluginList)
        {
            if (plugin_step.plugins.IsWorkflowActivity == false)
            {
                writer.WriteLine(new string[] { tempPluginAssembly.Name, tempPluginAssembly.Description, plugin_step.plugins.Name, String.Empty });
                ++pluginCount;
            }
        }
    }
}
于 2012-06-19T13:39:19.647 に答える