public void RegisterPlugin(string file) { var assemblyFilePath = new FileInfo(file); if (_ignoredAssemblies.Contains(assemblyFilePath.Name)) { return; } // Load each assembly Assembly peekAssembly = Reflection.ReflectionOnlyLoadAssembly(assemblyFilePath.FullName); if (peekAssembly == null) { return; } _trace.WriteLine("Checking assembly '{0}' for plugins", assemblyFilePath.Name); // Search for any types that interhit from IPlugin IEnumerable <Type> pluginTypes = Reflection.GetTypesImplementingInterface(peekAssembly, typeof(Microsoft.Xrm.Sdk.IPlugin)); if (pluginTypes.Count() > 0) { _trace.WriteLine("{0} plugin(s) found!", pluginTypes.Count()); var plugin = RegisterAssembly(assemblyFilePath, peekAssembly, pluginTypes); if (plugin != null) { RegisterPluginSteps(pluginTypes, plugin); } } }
public void RegisterWorkflowActivities(string path) { var assemblyFilePath = new FileInfo(path); if (_ignoredAssemblies.Contains(assemblyFilePath.Name)) { return; } // Load each assembly Assembly assembly = Reflection.ReflectionOnlyLoadAssembly(assemblyFilePath.FullName); if (assembly == null) { return; } // Search for any types that interhit from IPlugin IEnumerable <Type> pluginTypes = Reflection.GetTypesInheritingFrom(assembly, typeof(System.Activities.CodeActivity)); if (pluginTypes.Count() > 0) { var plugin = RegisterAssembly(assemblyFilePath, assembly, pluginTypes); if (plugin != null) { RegisterActivities(pluginTypes, plugin); } } }
public void RegisterPlugin(string file, bool excludePluginSteps = false, string registrationRegex = null) { var assemblyFilePath = new FileInfo(file); if (_ignoredAssemblies.Contains(assemblyFilePath.Name)) { return; } // Load each assembly Assembly peekAssembly = Reflection.ReflectionOnlyLoadAssembly(assemblyFilePath.FullName); if (peekAssembly == null) { return; } _trace.WriteLine("Checking assembly '{0}' for plugins", assemblyFilePath.Name); // Search for any types that interhit from IPlugin IEnumerable <Type> pluginTypes = Reflection.GetTypesImplementingInterface(peekAssembly, typeof(Microsoft.Xrm.Sdk.IPlugin)); if (pluginTypes.Any()) { _trace.WriteLine("{0} plugin(s) found!", pluginTypes.Count()); var plugin = RegisterAssembly(assemblyFilePath, peekAssembly, pluginTypes); if (plugin != null && !excludePluginSteps) { if (!string.IsNullOrEmpty(registrationRegex)) { var regex = new Regex(registrationRegex); pluginTypes = pluginTypes.Where(p => regex.Match(p.FullName).Success); } RegisterPluginSteps(pluginTypes, plugin); } } }