Esempio n. 1
0
        public void Build()
        {
            foreach (INamedTypeSymbol symbol in GetSymbolsForNativeApi())
            {
                if (symbol.TypeKind == TypeKind.Enum)
                {
                    Enums.Add(symbol.Name, symbol);
                    continue;
                }
                if (IsRefCountedTypeSymbol(symbol))
                {
                    RefCounted.Add(symbol.Name, symbol);
                    continue;
                }
                if (IsScopedTypeSymbol(symbol))
                {
                    Scoped.Add(symbol.Name, symbol);
                    continue;
                }

                if (symbol.TypeKind != TypeKind.Struct)
                {
                    continue;
                }

                if (IsSizedStruct(symbol))
                {
                    Sized.Add(symbol.Name, symbol);
                    continue;
                }

                Simple.Add(symbol.Name, symbol);
            }
        }
Esempio n. 2
0
        public DIHelper TryAddScoped <TService>() where TService : class
        {
            var serviceName = $"{typeof(TService)}";

            if (!Scoped.Contains(serviceName))
            {
                Scoped.Add(serviceName);
                ServiceCollection.TryAddScoped <TService>();
            }
            return(this);
        }
Esempio n. 3
0
        public DIHelper TryAddScoped <TService, TImplementation>(TService tservice, TImplementation tImplementation) where TService : Type where TImplementation : Type
        {
            var serviceName = $"{tservice}{tImplementation}";

            if (!Scoped.Contains(serviceName))
            {
                Scoped.Add(serviceName);
                ServiceCollection.TryAddScoped(tservice, tImplementation);
            }

            return(this);
        }
Esempio n. 4
0
        public DIHelper TryAddScoped <TService, TImplementation>() where TService : class where TImplementation : class, TService
        {
            var serviceName = $"{typeof(TService)}{typeof(TImplementation)}";

            if (!Scoped.Contains(serviceName))
            {
                Scoped.Add(serviceName);
                ServiceCollection.TryAddScoped <TService, TImplementation>();
            }

            return(this);
        }
Esempio n. 5
0
        public bool TryAddScoped <TService>() where TService : class
        {
            var serviceName = $"{typeof(TService)}";

            if (!Scoped.Contains(serviceName))
            {
                Scoped.Add(serviceName);
                ServiceCollection.TryAddScoped <TService>();
                return(true);
            }
            return(false);
        }