| description | AccessDBProviderSample05 |
|---|---|
| ms.date | 09/13/2016 |
| ms.topic | reference |
| title | AccessDBProviderSample05 |
This sample shows how to overwrite container methods to support calls to the Move-Item and
Join-Path cmdlets. These methods should be implemented when the user needs to move items within a
container and if the data store contains nested containers. The provider class in this sample
derives from the
System.Management.Automation.Provider.NavigationCmdletProvider
class.
Important
Your provider class will most likely derive from one of the following classes and possibly implement other provider interfaces:
- System.Management.Automation.Provider.ItemCmdletProvider class. See AccessDBProviderSample03.
- System.Management.Automation.Provider.ContainerCmdletProvider class. See AccessDBProviderSample04.
- System.Management.Automation.Provider.NavigationCmdletProvider class.
For more information about choosing which provider class to derive from based on provider features, see Designing Your Windows PowerShell Provider.
This sample demonstrates the following:
-
Declaring the
CmdletProviderattribute. -
Defining a provider class that derives from the System.Management.Automation.Provider.NavigationCmdletProvider class.
-
Overwriting the System.Management.Automation.Provider.NavigationCmdletProvider.MoveItem* method to change the behavior of the
Move-Itemcmdlet, allowing the user to move items from one location to another. (This sample does not show how to add dynamic parameters to theMove-Itemcmdlet.) -
Overwriting the System.Management.Automation.Provider.NavigationCmdletProvider.MakePath* method to change the behavior of the
Join-Pathcmdlet. -
Overwriting the System.Management.Automation.Provider.NavigationCmdletProvider.IsItemContainer* method.
-
Overwriting the System.Management.Automation.Provider.NavigationCmdletProvider.GetChildName* method.
-
Overwriting the System.Management.Automation.Provider.NavigationCmdletProvider.GetParentPath* method.
-
Overwriting the System.Management.Automation.Provider.NavigationCmdletProvider.NormalizeRelativePath* method.
This sample shows how to overwrite the methods needed to move items in a Microsoft Access data base.
:::code language="csharp" source="~/../powershell-sdk-samples/SDK-2.0/csharp/AccessDBProviderSample05/AccessDBProviderSample05.cs" range="11-1960":::
System.Management.Automation.Provider.ItemCmdletProvider
System.Management.Automation.Provider.ContainerCmdletProvider
System.Management.Automation.Provider.NavigationCmdletProvider