using System; using System.Collections.Generic; using Luticate2.Auth.Business.Auth; using Luticate2.Auth.Business.Auth.DMEC; using Luticate2.Auth.Business.Auth.PartialObjectCopier; using Luticate2.Auth.Business.Fields.DMEC; using Luticate2.Auth.ConsoleSample.Commands; using Luticate2.Auth.DataAccess; using Luticate2.Auth.DataAccess.Models; using Luticate2.Auth.Dbo.Auth; using Luticate2.Auth.Interfaces; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using NClap.Metadata; using NClap.Repl; namespace Luticate2.Auth.ConsoleSample { enum CommandsEnum { [Command(typeof(ListCommand), Description = "Lists Luticate2 items", LongName = "ls", ShortName = "l")] ListItems, [Command(typeof(CreateCommand), Description = "Creates Luticate2 items", LongName = "create", ShortName = "c")] CreateItems, [Command(typeof(ExitCommand), Description = "Exits the shell")] Exit } class Program { public static IServiceProvider ServiceProvider; protected static void AddILuExpressionConverter(IServiceCollection services) where TTypeImpl : class, ILuExpressionConverter { services.AddSingleton, TTypeImpl>(); services.TryAddSingleton, TTypeImpl>(); } static void Main(string[] args) { IServiceCollection services = new ServiceCollection(); services.AddScoped(); services.AddSingleton, LuPOCObjectsMetadataToDbo>(); services.AddSingleton, LuPOCGroupsToDbo>(); services.AddSingleton, LuPOCGroupsToModel>(); // services.AddSingleton, LuDMECTest1>(); AddILuExpressionConverter(services); AddILuExpressionConverter>(services); AddILuExpressionConverter>(services); AddILuExpressionConverter>(services); // services.AddSingleton, LuFieldsExpressionsLuMetadataDboLuMetadata>(); // services.AddSingleton, LuFieldsExpressionsLuGroupDboLuGroups>(); // // services.AddSingleton, LuFieldsExpressionsString>(); // services.AddSingleton, LuFieldsExpressions>(); // services.AddSingleton, LuFieldsExpressions>(); // // services.AddSingleton, LuFieldsExpressions>(); // services.AddSingleton, LuFieldsExpressions>(); // services.AddSingleton, LuFieldsExpressions>(); // services.AddSingleton, LuFieldsExpressions>(); // // services.AddSingleton, LuFieldsExpressions>(); // services.AddSingleton, LuFieldsExpressions>(); // services.AddSingleton, LuFieldsExpressions>(); // services.AddSingleton, LuFieldsExpressions>(); services.AddDbContext(options => { options.UseNpgsql(@"Host=localhost;Database=luticate2;Username=dev;Password=dev"); options.UseInternalServiceProvider(new ServiceCollection() .AddEntityFrameworkNpgsql() .BuildServiceProvider()); }, ServiceLifetime.Transient); ServiceProvider = services.BuildServiceProvider(); var loop = new Loop(typeof(CommandsEnum)); loop.Execute(); } } }