Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions src/System.Management.Automation/engine/DataStoreAdapterProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class ProviderInfo
/// </summary>
private SessionState _sessionState;

private string _fullName;

/// <summary>
/// Gets the name of the provider.
/// </summary>
Expand All @@ -47,29 +49,34 @@ internal string FullName
{
get
{
string result = this.Name;
if (!string.IsNullOrEmpty(this.PSSnapInName))
string GetFullName(string name, string psSnapInName, string moduleName)
{
result =
string.Format(
System.Globalization.CultureInfo.InvariantCulture,
"{0}\\{1}",
this.PSSnapInName,
this.Name);
}
string result = name;
if (!string.IsNullOrEmpty(psSnapInName))
{
result =
string.Format(
System.Globalization.CultureInfo.InvariantCulture,
"{0}\\{1}",
psSnapInName,
name);
}

// After converting core snapins to load as modules, the providers will have Module property populated
else if (!string.IsNullOrEmpty(this.ModuleName))
{
result =
string.Format(
System.Globalization.CultureInfo.InvariantCulture,
"{0}\\{1}",
this.ModuleName,
this.Name);
// After converting core snapins to load as modules, the providers will have Module property populated
else if (!string.IsNullOrEmpty(moduleName))
{
result =
string.Format(
System.Globalization.CultureInfo.InvariantCulture,
"{0}\\{1}",
moduleName,
name);
}

return result;
}

return result;
return _fullName ?? (_fullName = GetFullName(Name, PSSnapInName, ModuleName));
}
}

Expand Down Expand Up @@ -136,6 +143,7 @@ public string ModuleName
internal void SetModule(PSModuleInfo module)
{
Module = module;
_fullName = null;
}

/// <summary>
Expand Down