Please note that this release is not backwards compatible with previous releases because I have changed the name of the file that stores the instance of T. The reason for this change was that previously the filenames could end up being too long and thus throw an error.New method overloads to allow specification of a handle for the saved object thus supporting the saving of multiple instances of T.
Code below demonstrates this new capability:
[TestMethod]
public async Task SaveAndLoadTwoObjectsOfSameTypeUsingDifferentHandles()
{
//Declare two instances of the same type. Notice how we only have one instance of ObjectStorageHelper<T>
var poco = new Poco() { IntProp = 1, StringProp = "one" };
var anotherPoco = new Poco() { IntProp = 2, StringProp = "two" };
var osh = new ObjectStorageHelper<Poco>(StorageType.Local);
//Store them both then retrieve them both. In each case, use a different handle.
await osh.SaveAsync(poco, handle);
await osh.SaveAsync(anotherPoco, handle2);
var result = await osh.LoadAsync(handle);
var anotherResult = await osh.LoadAsync(handle2);
//Check that the second call to SaveASync() did not overwrite the object saved by first call to SaveAsync()
Assert.AreEqual(poco, result);
Assert.AreEqual(anotherPoco, anotherResult);
}
Also added XML documentation comments. Which is nice.