This is a quick introduction to get started.
Root object is RepositoryManager.
using(IRepositoryManager manager = new RepositoryManager(@"c:\data\repositories\test"))
{
	IRepositoryFolder folder = manager.RootFolder.CreateSubfolder("MyFolder");
	// set some metadata
	folder.Properties.Description = "My mega folder";
	folder.Properties.SetCustomProperty("My_arbitrary_property", "Mega property value");
	
	using (IRepositoryWriter writer = folder.GetWriter())
	{
		// writing some data
		for (int n = 0; n < 100; ++n)
		{
			Mock.TestDataItem item = Mock.TestDataItem.GetTestItem(n);
			item.DateTime = DateTime.UtcNow;
			writer.Write(item);
		}
		// flushing buffers to disk
		writer.Flush();
		writer.Close();
	}
	// now read something written 10 milliseconds back or later, no recursion
	using (IRepositoryReader reader = folder.GetReader(DateTime.UtcNow.AddMilliseconds(-10), false))
	{
		IDataItemRead dataItem = reader.Read();
	}
}



Your data items must implement IDataItem interface and be serializable, see http://hdrepository.codeplex.com/SourceControl/changeset/view/6845#167403.

For more usage examples (until documentation is improved) please see tests, in particular RepositoryTests.QuickReaderTest() - http://hdrepository.codeplex.com/SourceControl/changeset/view/6845#167378.

Last edited Nov 16, 2011 at 10:10 AM by vasokolbaso, version 9

Comments

No comments yet.