Exemplo n.º 1
0
        public BaseJournal()
        {
            PublishStrategy = new CourierDelivery();
            CurrentState    = new Editing();
            AdapterTarget   = new SubscriberAdapter(new AdapteeService());

            subscribers = new List <SubscriberInfo>();
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 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);
Exemplo n.º 4
0
 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];
Exemplo n.º 5
0
 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
 });
Exemplo n.º 6
0
 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);