Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 internal bool HasCreatedType(string className)
 {
     return(AllCreatedTypes.FirstOrDefault(t => t.ClassName == className) != null);
 }