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); } }
public DIHelper TryAddScoped <TService>() where TService : class { var serviceName = $"{typeof(TService)}"; if (!Scoped.Contains(serviceName)) { Scoped.Add(serviceName); ServiceCollection.TryAddScoped <TService>(); } return(this); }
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); }
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); }
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); }