src/NuGetGallery.Services/PackageManagement/ReservedNamespaceService.cs
/// <summary>
/// This method fetches the reserved namespace matching the prefix and adds the 
/// package registration entry to the reserved namespace, the provided package registration
/// should be an entry in the database or an entity from memory to be committed. It is the caller's
/// responsibility to commit the changes to the entity context.
/// </summary>
/// <param name="prefix">The prefix value of the reserved namespace to modify</param>
/// <param name="packageRegistration">The package registration entity entry to be added.</param>
/// <returns>Awaitable task</returns>
This method fetches the reserved namespace matching the prefix and adds the
package registration entry to the reserved namespace, the provided package registration
should be an entry in the database or an entity from memory to be committed. It is the caller's
responsibility to commit the changes to the entity context.
This method fetches the reserved namespace matching the prefix and adds the package registration entry to the reserved namespace the provided package registration should be an entry in the database or an entity from memory to be committed . It is the caller ' s responsibility to commit the changes to the entity context .
public void AddPackageRegistrationToNamespace(string prefix, PackageRegistration packageRegistration)
        {
            if (string.IsNullOrWhiteSpace(prefix))
            {
                throw new ArgumentException(ServicesStrings.ReservedNamespace_InvalidNamespace);
            }
            if (packageRegistration == null)
            {
                throw new ArgumentNullException(nameof(packageRegistration));
            }
            var namespaceToModify = FindReservedNamespaceForPrefix(prefix)
                ?? throw new InvalidOperationException(string.Format(
                    CultureInfo.CurrentCulture, ServicesStrings.ReservedNamespace_NamespaceNotFound, prefix));
            namespaceToModify.PackageRegistrations.Add(packageRegistration);
        }
public void AddPackageRegistrationToNamespace ( string prefix , PackageRegistration packageRegistration ) { if ( string . IsNullOrWhiteSpace ( prefix ) ) { throw new ArgumentException ( ServicesStrings . ReservedNamespace_InvalidNamespace ) ; } if ( packageRegistration == null ) { throw new ArgumentNullException ( nameof ( packageRegistration ) ) ; } var namespaceToModify = FindReservedNamespaceForPrefix ( prefix ) ?? throw new InvalidOperationException ( string . Format ( CultureInfo . CurrentCulture , ServicesStrings . ReservedNamespace_NamespaceNotFound , prefix ) ) ; namespaceToModify . PackageRegistrations . Add ( packageRegistration ) ; }
This method fetches the reserved namespace matching the prefix and adds the
package registration entry to the reserved namespace, the provided package registration
should be an entry in the database or an entity from memory to be committed.
This method fetches the reserved namespace matching the prefix and adds the package registration entry to the reserved namespace the provided package registration should be an entry in the database or an entity from memory to be committed .
None
prefix
string
The prefix value of the reserved namespace to modify
The prefix value of the reserved namespace to modify
packageRegistration
PackageRegistration
The package registration entity entry to be added.
The package registration entity entry to be added .