Exemplo n.º 1
0
 internal static IEnumerableAsync <Adapter> CreateOrUpdateBatch(IEnumerable <KeyValuePair <string, Guid> > keyAndConnectorKvps, Guid integrationId, string resourceType)
 {
     return(AzureStorageRepository.Connection(
                azureStorageRepository =>
     {
         var adapters = keyAndConnectorKvps
                        .Select(
             keyAndConnectorKvp =>
         {
             var adapter = new AdapterDocument()
             {
                 Key = keyAndConnectorKvp.Key,
                 IntegrationId = integrationId,
                 ResourceType = resourceType,
             };
             adapter.SetConnectorIds(new[] { keyAndConnectorKvp.Value });
             return adapter;
         });
         return azureStorageRepository
         .CreateOrReplaceBatch(adapters,
                               adapter => GetId(adapter.Key, integrationId, resourceType),
                               (successAdapter) => successAdapter,
                               (failedAdapter) => failedAdapter)
         .Select(adapter => Convert(adapter));
     }));
 }
Exemplo n.º 2
0
 internal static Adapter Convert(AdapterDocument syncDoc)
 {
     return(new Adapter
     {
         adapterId = syncDoc.Id,
         key = syncDoc.Key,
         integrationId = syncDoc.IntegrationId,
         name = syncDoc.Name,
         identifiers = syncDoc.GetIdentifiers(),
         connectorIds = syncDoc.GetConnectorIds(),
         resourceType = syncDoc.ResourceType,
     });
 }
Exemplo n.º 3
0
        internal static AdapterDocument Convert(Adapter adapter)
        {
            var adapterDoc = new AdapterDocument()
            {
                Key           = adapter.key,
                IntegrationId = adapter.integrationId,
                ResourceType  = adapter.resourceType,
                Name          = adapter.name,
            };

            adapterDoc.SetConnectorIds(adapter.connectorIds);
            adapterDoc.SetIdentifiers(adapter.identifiers);
            return(adapterDoc);
        }
Exemplo n.º 4
0
 public Guid GetId()
 {
     return(AdapterDocument.GetId(this.Key, this.IntegrationId, this.ResourceType));
 }