GitObjectDb simplifies the configuration management versioning by backing it in Git.
GitObjectDb is designed to simplify the configuration management versioning. It does so by removing the need for hand-coding the commands needed to interact with Git.
The Git repository is used as a pure database as the files containing the serialized copy of the objects are never fetched in the filesystem. GitObjectDb only uses the blob storage provided by Git.
Here's a simple example:
- Define your own data model by inheriting from
AbstractObjectRepository
:Note that this object containspublic class ObjectRepository : AbstractObjectRepository { public ObjectRepository(IServiceProvider serviceProvider, Guid id, string name, ILazyChildren<IMigration> migrations, ILazyChildren<Application> applications) : base(serviceProvider, id, name, migrations) { Applications = (applications ?? throw new ArgumentNullException(nameof(applications))).AttachToParent(this); } public ILazyChildren<Application> Applications { get; } }
Applications
of typeILazyChildren<Application>
. That's how you can create nested objects. They must be of typeILazyChildren<Application>
. - Create nested object types:
[DataContract] public class Application : AbstractModel { public Application(IServiceProvider serviceProvider, Guid id, string name, ILazyChildren<Page> pages) : base(serviceProvider, id, name) { Pages = (pages ?? throw new ArgumentNullException(nameof(pages))).AttachToParent(this); } public ILazyChildren<Page> Pages { get; } }
- Basic commands
-
Initialize a new repository
var repo = new ObjectRepository(...); repo.SaveInNewRepository(signature, message, new RepositoryDescription(path));
-
Commit a new change
var modifiedPage = page.With(p => p.Name == "modified"); instance.Commit(modifiedPage.Repository, signature, message);
-
Migrations:
Migrations allows to define any action that must be executed when the commit containing the migration will be processed by a pull. See the unit tests for more details.
-
- Windows: .NET 4.0+
- Linux/Mac OS X: Mono 3.6+
- LibGit2Sharp (Requires NuGet 2.7+)
- Fork and clone locally
- Create a topic specific branch. Add some nice feature. Do not forget the tests ;-)
- Send a Pull Request to spread the fun!
The MIT license (Refer to the LICENSE file)