protected override void OnRegeneratingAssembly() { IEnumerable <ITypeConfig> uncompiledTypes = AllCreatedTypes.Except(AllTypesAddedToCompilation).ToList(); if (uncompiledTypes.Count() > 0) { string errorMessage = "Usage Error: some of the created TypeConfigs have not been compiled. Either do not create them or compile them all.\n"; errorMessage += $"Here are the classNames that have not been compiled: {uncompiledTypes.Select(t => t.ClassName).StrConcat()}"; throw new Exception(errorMessage); } }
FindOrCreateTypeConf <TImplementedInterface, TSuperClass, TWrappedInterface>(string className = null) { // if null - take the name of the interface without first letter 'I' className = className.GetClassName <TImplementedInterface>(); ITypeConfig <TImplementedInterface, TSuperClass, TWrappedInterface> result = (ITypeConfig <TImplementedInterface, TSuperClass, TWrappedInterface>) AllCreatedTypes.FirstOrDefault(typeConfig => typeConfig.ClassName == className); if (result == null) { result = CreateTypeConf <TImplementedInterface, TSuperClass, TWrappedInterface>(className); } return(result); }
internal ITypeConfig FindOrCreateTypeConf ( string className, INamedTypeSymbol implInterfaceTypeSymbol, INamedTypeSymbol superClassTypeSymbol, INamedTypeSymbol wrapInterfaceTypeSymbol ) { // if null - take the name of the interface without first letter 'I' className = implInterfaceTypeSymbol.GetClassName(className); ITypeConfig result = AllCreatedTypes.FirstOrDefault(typeConfig => typeConfig.ClassName == className); if (result == null) { result = CreateTypeConf(className, implInterfaceTypeSymbol, superClassTypeSymbol, wrapInterfaceTypeSymbol); } return(result); }
internal bool HasCreatedType(string className) { return(AllCreatedTypes.FirstOrDefault(t => t.ClassName == className) != null); }