diff --git a/Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/GetDataverseConnectionCmdlet.cs b/Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/GetDataverseConnectionCmdlet.cs index 13461b0..9abea26 100644 --- a/Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/GetDataverseConnectionCmdlet.cs +++ b/Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/GetDataverseConnectionCmdlet.cs @@ -27,26 +27,6 @@ public GetDataverseConnectionCmdlet() { } - static GetDataverseConnectionCmdlet() - { - AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - } - - private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - string assyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - - string assyName = args.Name.Split(',')[0]; - string assyFile = assyDir + "/" + assyName + ".dll"; - - if (File.Exists(assyFile)) - { - return Assembly.LoadFrom(assyFile); - } - - return null; - } - private const string PARAMSET_CLIENTSECRET = "Authenticate with client secret"; private const string PARAMSET_INTERACTIVE = "Authenticate interactively"; private const string PARAMSET_DEVICECODE = "Authenticate using the device code flow"; diff --git a/Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/ModuleInitProvider.cs b/Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/ModuleInitProvider.cs new file mode 100644 index 0000000..96af620 --- /dev/null +++ b/Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific/Commands/ModuleInitProvider.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Management.Automation.Provider; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace Rnwood.Dataverse.Data.PowerShell.FrameworkSpecific.Commands +{ + [CmdletProvider("Dataverse", ProviderCapabilities.None)] + public class ModuleInitProvider : DriveCmdletProvider + { + protected override Collection InitializeDefaultDrives() + { + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; + + var assy = Assembly.Load(new AssemblyName("Microsoft.Xrm.Sdk")); + WriteVerbose($"Loaded Dataverse SDK from {assy.Location}"); + + return base.InitializeDefaultDrives(); + } + + private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) + { + string assyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + string assyName = args.Name.Split(',')[0]; + string assyFile = assyDir + "/" + assyName + ".dll"; + + if (File.Exists(assyFile)) + { + return Assembly.LoadFrom(assyFile); + } + + return null; + } + } +} diff --git a/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.csproj b/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.csproj index d379863..98047e3 100644 --- a/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.csproj +++ b/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.csproj @@ -44,12 +44,12 @@ - - - - + + + + - + diff --git a/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.psd1 b/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.psd1 index 359780c..facb5ec 100644 Binary files a/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.psd1 and b/Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.psd1 differ diff --git a/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataverseRecord.md b/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataverseRecord.md index 5281020..553219e 100644 --- a/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataverseRecord.md +++ b/Rnwood.Dataverse.Data.PowerShell/docs/Remove-DataverseRecord.md @@ -15,7 +15,8 @@ Deletes an existing Dataverse record. ``` Remove-DataverseRecord -Connection [-InputObject ] -TableName -Id [-BatchSize ] [-IfExists] [-BypassBusinessLogicExecution ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-BypassBusinessLogicExecutionStepIds ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -194,6 +195,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -BypassBusinessLogicExecutionStepIds +Specifies the IDs of plugin steps to bypass + +```yaml +Type: Guid[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseRecord.md b/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseRecord.md index 272a111..a57bfda 100644 --- a/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseRecord.md +++ b/Rnwood.Dataverse.Data.PowerShell/docs/Set-DataverseRecord.md @@ -17,7 +17,8 @@ Set-DataverseRecord -Connection -InputObject [-BatchS -TableName [-IgnoreProperties ] [-Id ] [-MatchOn ] [-PassThru] [-NoUpdate] [-NoCreate] [-NoUpdateColumns ] [-CallerId ] [-UpdateAllColumns] [-CreateOnly] [-Upsert] [-LookupColumns ] [-BypassBusinessLogicExecution ] - [-ProgressAction ] [-WhatIf] [-Confirm] [] + [-BypassBusinessLogicExecutionStepIds ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -379,6 +380,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -BypassBusinessLogicExecutionStepIds +Specifies the IDs of plugin steps to bypass + +```yaml +Type: Guid[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/tests/Common.ps1 b/tests/Common.ps1 index 762a770..d00e93a 100644 --- a/tests/Common.ps1 +++ b/tests/Common.ps1 @@ -7,7 +7,6 @@ BeforeAll { } Add-Type -AssemblyName "System.Runtime.Serialization" - Add-Type -AssemblyName "Microsoft.Xrm.Sdk" # Define the DataContractSerializer $serializer = New-Object System.Runtime.Serialization.DataContractSerializer([Microsoft.Xrm.Sdk.Metadata.EntityMetadata])