description | ms.date | ms.topic | title |
---|---|---|---|
AccessDBProviderSample05 |
09/13/2016 |
reference |
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
CmdletProvider
attribute. -
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-Item
cmdlet, allowing the user to move items from one location to another. (This sample does not show how to add dynamic parameters to theMove-Item
cmdlet.) -
Overwriting the System.Management.Automation.Provider.Navigationcmdletprovider.Makepath* method to change the behavior of the
Join-Path
cmdlet. -
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