public string CreateClassCode(CodeNames codeNames) { StringBuilder sb = new StringBuilder(); sb.Append( $@" internal class {GetClassNameAndTemplateParamaters(codeNames)} : {codeNames.BaseClassName}, {GetInterfaceNameAndTemplateParamaters(codeNames)} {{ internal {GetClassName(codeNames)}({codeNames.BaseClassName} settings) : base(settings) {{ }} "); CodeNames codeNameWithResult = new CodeNames(codeNames.ServiceCount, true, codeNames.IsAsync); PolicyScopeRunnerGenerator policyRunnerGenerator = new PolicyScopeRunnerGenerator(); sb.AppendLine( $@" public {policyRunnerGenerator.GetInterfaceNameAndTemplateParamaters(codeNames)} {WithNoResultName}() {{ return new {policyRunnerGenerator.GetClassNameAndTemplateParamaters(codeNames)}(this); }} public {policyRunnerGenerator.GetInterfaceNameAndTemplateParamaters(codeNameWithResult)} {WithResultName}<{CodeNames.TResultName}>() {{ return new {policyRunnerGenerator.GetClassNameAndTemplateParamaters(codeNameWithResult)}(this); }}"); sb.AppendLine( $@" }}"); return(sb.ToString()); }
public string CreateInterfaceCode(CodeNames codeNames) { StringBuilder sb = new StringBuilder(); sb.Append( $@" public interface {GetInterfaceNameAndTemplateParamaters(codeNames)} {{ "); CodeNames codeNameWithResult = new CodeNames(codeNames.ServiceCount, true, codeNames.IsAsync); PolicyScopeRunnerGenerator policyRunnerGenerator = new PolicyScopeRunnerGenerator(); sb.AppendLine( $@" {policyRunnerGenerator.GetInterfaceNameAndTemplateParamaters(codeNames)} WithNoResult(); "); sb.AppendLine( $@" {policyRunnerGenerator.GetInterfaceNameAndTemplateParamaters(codeNameWithResult)} WithResult<{CodeNames.TResultName}>();"); sb.AppendLine( $@" }}"); return(sb.ToString()); }