public BaseJournal() { PublishStrategy = new CourierDelivery(); CurrentState = new Editing(); AdapterTarget = new SubscriberAdapter(new AdapteeService()); subscribers = new List <SubscriberInfo>(); }
public static IServiceCollection CreateSingletonForEachAdapter(this IServiceCollection services, string postgresConfig) { accountAdapter = new AccountAdapter(postgresConfig); contractAdapter = new ContractAdapter(postgresConfig); deviceAdapter = new DeviceAdapter(postgresConfig); subscriberAdapter = new SubscriberAdapter(postgresConfig); return(services? .AddSingleton(accountAdapter) .AddSingleton(contractAdapter) .AddSingleton(deviceAdapter) .AddSingleton(subscriberAdapter)); }
public static async Task <string> GetLegalPersonForm(IResolverContext context, [Parent] Subscriber sub, [Service] SubscriberAdapter data) => await context.BatchDataLoader <int, string>("getForms", data.GetForms).LoadAsync(((Entity)sub).Id);
public static async Task <string> GetPhysicalPersonMiddleName(IResolverContext context, [Parent] Subscriber sub, [Service] SubscriberAdapter data) => (await context.BatchDataLoader <int, string>("getFullNames", data.GetFullNames).LoadAsync(((Entity)sub).Id)).Split(' ')[2];
public static async Task <IEnumerable <Contract> > GetContracts(IResolverContext context, [Parent] Subscriber sub, [Service] SubscriberAdapter data) => (await context.BatchDataLoader <int, IEnumerable <int> >("getContractIds", data.GetContractIds).LoadAsync(((Entity)sub).Id)) .Select(id => new Contract { Id = id });
public static async Task <IDictionary <string, string> > GetContactDetails(IResolverContext context, [Parent] Subscriber sub, [Service] SubscriberAdapter data) => await context.BatchDataLoader <int, IDictionary <string, string> >("getContactDetails", data.GetContactDetails).LoadAsync(((Entity)sub).Id);