Exemplo n.º 1
0
 public Task <IHalDeleteResult> Delete(IHalResource resource, IHalPersisterStrategy strategy = null)
 {
     strategy = strategy ?? GetDefaultPersisterStrategy(resource);
     if (strategy == null)
     {
         throw new HalPersisterException("No persister found for resource: " + resource);
     }
     return(Task <IHalDeleteResult>
            .Factory
            .StartNew(() => strategy.Delete(resource)));
 }
Exemplo n.º 2
0
 public void RegisterPersisterStrategy(IHalPersisterStrategy strategy)
 {
     strategy.HalClient  = this;
     strategy.HttpClient = HttpClient;
     Strategies.Add(strategy);
 }
Exemplo n.º 3
0
 public Task <IHalPersistResult <T> > Persist <T>(T resource, HalLink link = null, IHalPersisterStrategy strategy = null) where T : class, IHalResource
 {
     strategy = strategy ?? GetDefaultPersisterStrategy(resource);
     if (strategy == null)
     {
         throw new HalPersisterException("No persister found for resource: " + resource);
     }
     return(Task <IHalPersistResult <T> >
            .Factory
            .StartNew(() => strategy.Persist(resource, link)));
 }