fix the using issue in dotnet examples #8664
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because of a change in dotnet generator, now the dotnet generated code will not include using statements for those namespaces that are parent of the current namespace.
For example, if our current namespace is
Azure.ResourceManager.Compute.Samples:the
using Azure;,using Azure.ResourceManager;,using Azure.ResourceManager.Compute;statements will not be generated into the sample file, even if members from those namespaces are used below.This is fine when we are building the sample projects, but it is not fine if we extract the sample code into a standalone program which is under a different namespace.
This PR fixes this by adding the namespace trimming the
.Samplessuffix, and always add the namespace ofAzureandAzure.ResourceManagerbecause they are so common that every sample program should need them.