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