-
Notifications
You must be signed in to change notification settings - Fork 23
Sync to 180.10.0 #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Sync to 180.10.0 #213
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "8.0.414", | ||
| "version": "8.0.415", | ||
| "rollForward": "latestMinor" | ||
| }, | ||
| "msbuild-sdks": { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ; Shipped analyzer releases | ||
| ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md | ||
|
|
||
| ## Release 1.0 | ||
|
|
||
| ### New Rules | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ; Unshipped analyzer release | ||
| ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md | ||
|
|
||
|
|
||
| ### New Rules | ||
|
|
||
| Rule ID | Category | Severity | Notes | ||
| --------|----------|----------|-------------------- | ||
| SMOCOLL001 | SmoCollection | Error | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>netstandard2.0</TargetFrameworks> | ||
| <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> | ||
| <DefineConstants Condition="'$(DebugCollectionGenerator)' != ''">$(DefineConstants);DEBUGCOLLECTIONGENERATOR</DefineConstants> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <AdditionalFiles Include="AnalyzerReleases.Shipped.md" /> | ||
| <AdditionalFiles Include="AnalyzerReleases.Unshipped.md" /> | ||
| <None Include="README.md" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" /> | ||
| <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" /> | ||
| </ItemGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # Source Generators for SMO | ||
|
|
||
| We have two source generators in this project. | ||
|
|
||
| ## SmoCollectionGenerator | ||
|
|
||
| To simplify adding new object types and their corresponding collections to SMO, we have strongly typed base collection classes and a code generator that emits the body of the collection classes. | ||
| To add a new collection, a code author can simply declare the new collection class and specify which of the base classes it uses. | ||
|
|
||
| The source generator looks at the `UrnSuffix` and other properties of the generic type arguments to emit the body of the new collection class at build time. There are 4 base classes to choose from: | ||
|
|
||
| - `SimpleObjectCollectionBase` is the base of the other collections and should be used if your object type doesn't match the criteria for one of the other base classes. | ||
| - `RemovableCollectionBase` derives from `SimpleObjectCollectionBase` and can be used when your collection allows removal of elements when the parent of the collection is in `Creating` state. For example, an app can add or remove elements to `Database.FileGroups` before calling `Database.Create`, but afterward it can only call `Database.FileGroups.Add`. | ||
| - `SchemaCollectionBase` contains objects that are part of a database schema. | ||
| - `ParameterCollectionBase` contains elements whose enumeration order is based on their `ID` instead of on their `Name` | ||
|
|
||
| ### Examples | ||
|
|
||
| Input: | ||
|
|
||
| ```C# | ||
| public sealed partial class FileGroupCollection : RemovableCollectionBase<FileGroup, Database> | ||
| { | ||
| } | ||
| ``` | ||
|
|
||
| Output: | ||
|
|
||
| ```C# | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
| namespace Microsoft.SqlServer.Management.Smo | ||
| { | ||
| ///<summary> | ||
| ///Collection of FileGroup objects associated with an instance of Database | ||
| ///</summary> | ||
| public partial class FileGroupCollection | ||
| { | ||
| internal FileGroupCollection(SqlSmoObject parentInstance) : base((Database)parentInstance) | ||
| { | ||
| } | ||
|
|
||
| protected override string UrnSuffix => FileGroup.UrnSuffix; | ||
|
|
||
| internal override FileGroup GetCollectionElementInstance(ObjectKeyBase key, SqlSmoState state) => new FileGroup(this, key, state); | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| ## SqlSmoObjectGenerator | ||
|
|
||
| This source generator uses `SfcObject` attributes in the declaration of a `SqlSmoObject`-derived class to build switch statements that enable the scripting engine to map URN components to child property names without using reflection. Attributes using `SfcContainerRelationship` arguments identify child collections, while attributes using `SfcObjectRelationship` arguments identify child singletons. | ||
|
|
||
| ### Examples: | ||
|
|
||
| Input: | ||
|
|
||
| ```C# | ||
|
|
||
| [SfcObject(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.ZeroToAny, typeof(Index), SfcObjectFlags.Design | SfcObjectFlags.Deploy)] | ||
| public override IndexCollection Indexes | ||
| { | ||
| get { return base.Indexes; } | ||
| } | ||
|
|
||
| [SfcObject(SfcObjectRelationship.ChildObject, SfcObjectCardinality.One)] | ||
| public DatabaseOptions DatabaseOptions | ||
| { | ||
| get | ||
| { | ||
| CheckObjectStateImpl(false); | ||
| if (null == m_DatabaseOptions) | ||
| { | ||
| m_DatabaseOptions = new DatabaseOptions(this, new ObjectKeyBase(), this.State/*SqlSmoState.Existing*/); | ||
| } | ||
| return m_DatabaseOptions; | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Output: | ||
|
|
||
| ```C# | ||
| namespace Microsoft.SqlServer.Management.Smo | ||
| { | ||
| public partial class Database | ||
| { | ||
| protected override SqlSmoObject GetSingletonInstance(string childTypeName) | ||
| { | ||
| switch (childTypeName) | ||
| { | ||
| case "Option": | ||
| case "DatabaseOptions": | ||
| return DatabaseOptions; | ||
| case "QueryStoreOptions": | ||
| return QueryStoreOptions; | ||
| case "DatabaseEncryptionKey": | ||
| return DatabaseEncryptionKey; | ||
| case "MasterKey": | ||
| return MasterKey; | ||
| case "ServiceBroker": | ||
| return ServiceBroker; | ||
|
|
||
| default: | ||
| return base.GetSingletonInstance(childTypeName); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.