Latest Replies
Sunday
Dec142008

How to Find C# Samples of Lokad Shared Libraries?

Application blocks from the Microsoft patterns and practices group usually include sample reference implementations. These implementations were used to demonstrate specific usage scenarios in simplified extracts from the real-world applications.

Would not it be nice to have something like this for Lokad Shared Libraries?

Well, there already is Lokad SDK for .NET that has been built on top of the libraries (you can find more project details on the product page).

However this is not just an imaginary reference implementation, but rather a commercially supported open-source product.

This project is actually included in the sources that you get during checkout or download of the Lokad Shared Libraries (new BSD License). It features:

By the way, that's the policy that has allowed users to reliably execute moderately large transfer operations (2-4 hours needed to complete) against the web services:

var ex = ActionPolicy
  .With(e => WebClientPolicy(e, log))
  .Retry(3);

private static bool WebClientPolicy(Exception ex, ILog log)
{
  if (ex.Message.Contains("Authentication failed"))
  {
    return false;
  }

  if (ex is WebException)
  {
    log.Warn(ex, "Recoverable exception. Going to sleep");
    SystemUtil.Sleep(2.Seconds());
    return true;
  }
  log.Error(ex, "Unrecoverable exception");
  return false;
}

I'll be updating this page as more open-source implementation projects for Lokad Shared Libraries become available.

« How to use Linq Expressions to Find Out Variable Name in .NET? | Main | How to Find Out Variable or Parameter Name in C#? »