/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using Dbg = System.Management.Automation;
using System.Management.Automation.Internal;
namespace System.Management.Automation
{
///
/// Exposes the Cmdlet Family Providers to the Cmdlet base class. The methods of this class
/// use the providers to perform operations.
///
public sealed class ProviderIntrinsics
{
#region Constructors
///
/// Hide the default constructor since we always require an instance of SessionState
///
private ProviderIntrinsics()
{
Dbg.Diagnostics.Assert(
false,
"This constructor should never be called. Only the constructor that takes an instance of SessionState should be called.");
} // ProviderIntrinsics private
///
/// Constructs a facade over the "real" session state API
///
///
///
/// An instance of the cmdlet.
///
///
///
/// If is null.
///
///
internal ProviderIntrinsics(Cmdlet cmdlet)
{
if (cmdlet == null)
{
throw PSTraceSource.NewArgumentNullException("cmdlet");
}
_cmdlet = cmdlet;
Item = new ItemCmdletProviderIntrinsics(cmdlet);
ChildItem = new ChildItemCmdletProviderIntrinsics(cmdlet);
Content = new ContentCmdletProviderIntrinsics(cmdlet);
Property = new PropertyCmdletProviderIntrinsics(cmdlet);
#if SUPPORTS_IMULTIVALUEPROPERTYCMDLETPROVIDER
this.propertyValue = new PropertyValueCmdletProviderIntrinsics(cmdlet);
#endif
SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(cmdlet);
#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release
this.relationship = new RelationshipProviderIntrinsics(cmdlet.Context.EngineSessionState);
#endif
} // ProviderIntrinsics internal
///
/// Constructs a facade over the "real" session state API
///
///
///
/// An instance of the cmdlet.
///
///
internal ProviderIntrinsics(SessionStateInternal sessionState)
{
if (sessionState == null)
{
throw PSTraceSource.NewArgumentNullException("sessionState");
}
Item = new ItemCmdletProviderIntrinsics(sessionState);
ChildItem = new ChildItemCmdletProviderIntrinsics(sessionState);
Content = new ContentCmdletProviderIntrinsics(sessionState);
Property = new PropertyCmdletProviderIntrinsics(sessionState);
#if SUPPORTS_IMULTIVALUEPROPERTYCMDLETPROVIDER
this.propertyValue = new PropertyValueCmdletProviderIntrinsics(sessionState);
#endif
SecurityDescriptor = new SecurityDescriptorCmdletProviderIntrinsics(sessionState);
#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release
this.relationship = new RelationshipProviderIntrinsics(sessionState);
#endif
} // ProviderIntrinsics internal
#endregion Constructors
#region Public members
///
/// Gets the object that exposes the verbs for the item noun for Cmdlet Providers
///
public ItemCmdletProviderIntrinsics Item { get; }
///
/// Gets the object that exposes the verbs for the childItem noun for Cmdlet Providers
///
public ChildItemCmdletProviderIntrinsics ChildItem { get; }
///
/// Gets the object that exposes the verbs for the content noun for Cmdlet Providers
///
public ContentCmdletProviderIntrinsics Content { get; }
///
/// Gets the object that exposes the verbs for the property noun for Cmdlet Providers
///
public PropertyCmdletProviderIntrinsics Property { get; }
#if SUPPORTS_IMULTIVALUEPROPERTYCMDLETPROVIDER
///
/// The object that exposes the verbs for the item propertyvalue for Cmdlet Providers
///
///
public PropertyValueCmdletProviderIntrinsics PropertyValue
{
get { return propertyValue; }
}
#endif
///
/// Gets the object that exposes the verbs for the SecurityDescriptor noun for Cmdlet Providers
///
public SecurityDescriptorCmdletProviderIntrinsics SecurityDescriptor { get; }
#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release
///
/// The object that exposes the verbs for the relationship providers
///
///
public RelationshipProviderIntrinsics Relationship
{
get { return relationship; }
}
#endif
#endregion Public members
#region private data
private InternalCommand _cmdlet;
#if SUPPORTS_IMULTIVALUEPROPERTYCMDLETPROVIDER
private PropertyValueCmdletProviderIntrinsics propertyValue;
#endif
#if RELATIONSHIP_SUPPORTED
// 2004/11/24-JeffJon - Relationships have been removed from the Exchange release
private RelationshipProviderIntrinsics relationship = null;
#endif
#endregion private data
} // ProviderIntrinsics
}