using Microsoft.Extensions.DependencyInjection; using System.Collections.ObjectModel; namespace Toolkit.Framework.Foundation; public class ContentTemplateBuilder : IContentTemplateBuilder { private readonly List descriptors = new(); public IReadOnlyCollection Descriptors => new ReadOnlyCollection(descriptors); public IContentTemplateBuilder Add(string name, ServiceLifetime lifetime = ServiceLifetime.Transient) { descriptors.Add(new ContentTemplateDescriptor(typeof(TViewModel), typeof(TView), name, lifetime)); return this; } public IContentTemplateBuilder Add(ServiceLifetime lifetime = ServiceLifetime.Transient) { descriptors.Add(new ContentTemplateDescriptor(typeof(TViewModel), typeof(TView), null, lifetime)); return this; } }