OptionsNamingHelper
NexusLabs.Needlr.Generators¶
NexusLabs.Needlr.Generators.Helpers¶
OptionsNamingHelper Class¶
Helper methods for inferring configuration section names from options class names.
Inheritance System.Object 🡒 OptionsNamingHelper
Methods¶
OptionsNamingHelper.GetMatchedSuffix(string) Method¶
Gets the suffix that was matched and would be stripped from the class name, if any.
Parameters¶
className System.String
The options class name.
Returns¶
System.String
The matched suffix, or null if no suffix matches.
OptionsNamingHelper.InferSectionName(string) Method¶
Infers the configuration section name from a class name. Strips common suffixes (Options, Settings, Config) if present and the result is non-empty.
Parameters¶
className System.String
The options class name.
Returns¶
System.String
The inferred section name.
Example¶
InferSectionName("DatabaseOptions") // returns "Database"
InferSectionName("CacheSettings") // returns "Cache"
InferSectionName("RedisConfig") // returns "Redis"
InferSectionName("FeatureFlags") // returns "FeatureFlags" (no suffix match)
InferSectionName("Options") // returns "Options" (would be empty after stripping)