Global options should only be accessed (get/set) via IGlobalOptionService. They are only available in-proc and in EditorFeatures layer and above. Global options should be used for client configuration (UI).
Solution.Options is obsolete. This property will remain for API compat and will only be populated with public options in-proc. It will be empty OOP. All currently used solution options are converted to global options.
Workspace.Options is obsolete and equivalent to Workspace.CurrentSolution.Options.
IOptionProvider and ExportOptionProvider are removed.
Instead of reading solution-scoped options from Solution.Options remote services should receive them via a parameter. The parameter should be a readonly record struct XyzOptions or record class XyzOptions following pattern:
Workspace or Features (server) layer:
[DataContract]
internal readonly record struct XyzOptions(
[property: DataMember(Order = 0)] bool OptionA = true,
[property: DataMember(Order = 1)] bool OptionB = false)
{
public XyzOptions() : this(OptionA: true) {}
public static readonly XyzOptions Default = new();
}
EditorFeatures (client) layer:
internal static class XyzOptionsStorage
{
public static XyzOptions GetXyzOptions(this IGlobalOptionService options, string language)
=> new(
OptionA: options.GetOption(OptionA, language),
OptionB: options.GetOption(OptionB, language)));
public static readonly Option2<bool> OptionA = new("XyzOptions", "OptionA", XyzOptions.Default.OptionA, storageLocation: ...);
public static readonly Option2<bool> OptionB = new("XyzOptions", "OptionB", XyzOptions.Default.OptionB, storageLocation: ...);
}
This approach makes it clear which options the service depends on and potentially allows us to reuse the results when unrelated options change.
Option metadata/storage (IOption) is a client concept - it specifies where and how the option is stored. A feature implementation (server code) shouldn't concern itself with such information and thus should not refer to IOption objects. Using the above pattern a feature implementation would operate on XyzOptions type. XyzOptionsStorage is client-only.
TODO:
Related:
Global options should only be accessed (get/set) via
IGlobalOptionService. They are only available in-proc and in EditorFeatures layer and above. Global options should be used for client configuration (UI).Solution.Optionsis obsolete. This property will remain for API compat and will only be populated with public options in-proc. It will be empty OOP. All currently used solution options are converted to global options.Workspace.Optionsis obsolete and equivalent toWorkspace.CurrentSolution.Options.IOptionProviderandExportOptionProviderare removed.Instead of reading solution-scoped options from
Solution.Optionsremote services should receive them via a parameter. The parameter should be areadonly record struct XyzOptionsorrecord class XyzOptionsfollowing pattern:Workspace or Features (server) layer:
EditorFeatures (client) layer:
This approach makes it clear which options the service depends on and potentially allows us to reuse the results when unrelated options change.
Option metadata/storage (
IOption) is a client concept - it specifies where and how the option is stored. A feature implementation (server code) shouldn't concern itself with such information and thus should not refer toIOptionobjects. Using the above pattern a feature implementation would operate onXyzOptionstype.XyzOptionsStorageis client-only.TODO:
Related: