Ottoman is an open-source CouchDB API for the .NET Framework written in C#.
C# Ruby JavaScript
Pull request Compare This branch is 81 commits ahead, 79 commits behind sinesignal:development.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


== Ottoman

Ottoman is intended to be an easy to use open source library for .NET applications 
using CouchDB for persistence.  Please excuse the mess, this is a new project and 
we are trying to get everything in order.  We will be setting up a project site,
mailing list, and issue tracker.  This will be an active open source project and 
backed by a company.  We have big plans for this library.

A little disclaimer:

Ottoman at it's current state is pre-alpha software and still under heavy development. 
Please be aware that important areas such as the public API may see backwards 
incompatible changes between versions.

== Building

To run the automated build tasks, you will need to have ruby installed on your local 
machine.  You can download the one click installer for windows from here:
After installation, make sure you grab the required gems by running at a command prompt:

	gem install rake
	gem install activesupport

Once you've cloned the repository to your local machine you're ready to run the automated 
build scripts.  Open a command prompt and navigate to the directory of your cloned 
repository (Hint:  The location of build.cmd).  Then you can run the build commands 
by typing without the quotes:

	To compile:  Type "build compile" or just "build" and hit enter.
	To run all tests:  Type "build test_all" and hit enter
	To run just unit tests:  Type "build test_unit" and hit enter
	To run just integration tests:  Type "build test_integration" and hit enter
	Note:  To run the integration tests.  The tests expect you to have a CouchDB server 
	       running at
== Using/Examples

The current state of Ottoman allows you to manage databases on your CouchDB server and create documents.  
All you need to get started, is the URL to the CouchDB server you want to connect to:

	IServer couchServer = Server.Connect("");
	IServer couchServer = Server.Connect();  // Uses the default Address of

Once you have an instance of Server, you can start manipulating the databases on your 
CouchDB server.

To create a database:
	If Ottoman was not able to create a database, a CannotCreateDatabaseException will 
	be thrown with the details of what happened.

To delete a database:

	If Ottoman was not able to delete a database, a CannotDeleteDatabaseException will 
	be thrown with the details of what happened.

To retrieve a list of databases:
	string[] databases = couchServer.GetDatabases();
To retrieve a database:

	IDatabase couchDatabase = couchServer.GetDatabase("test");
	You can view info about your database with the IDatabase instance.
	If Ottoman was not able to retrieve a database, a CannotGetDatabaseException will 
	be thrown with the details of what happened.
To save a document:

	This method will be used for creating and updating.  Right now we only have the creation 
	step in place.  There is one convention used that you need to be aware of.  The method 
	is expecting the ID of your object to have a protected or public property named Id.  
	It also needs to be of type System.Guid.  The method will generate the Id and assign 
	it for you.  We will add a feature later to generate Id's based on a generator, like 
	NHibernate.  Also, if something goes wrong, we are not throwing an exception.  That 
	is still on the TODO.  Otherwise, once you call save and all is well, you should see 
	your object in the database using Futon.  See the Unit test for on how it works.
	Once you have a database instance, like in the example above.  You can save an 
	object to the server under that database:
	public class Foo
		public Guid Id { get; protected set; }
		public Foo()
			Id = Guid.Empty;
	Foo foo = new Foo();
	That is it!
To retrieve a document by id:

	This method isn't totally done, but the current version will allow you retrieve documents 
	by id.  This should give you an idea on how easy it will be to retrieve your objects from 

	User user = couchDatabase.GetDocument<User>("id");

== License

Copyright 2007-2009 SineSignal, LLC.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   A copy of the License can be found in the LICENSE file or you may 
   obtain a copy of the License at

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   See the License for the specific language governing permissions and
   limitations under the License.

The Ottoman Dev Team