forked from dragan/ottoman
-
Notifications
You must be signed in to change notification settings - Fork 1
Ottoman is an open-source CouchDB API for the .NET Framework written in C#.
License
jwalgran/ottoman
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
== 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: http://www.ruby-lang.org/en/downloads/ 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 http://127.0.0.1:5984/. == 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("http://couchdb.domain.com:5984/"); or IServer couchServer = Server.Connect(); // Uses the default Address of http://127.0.0.1:5984/ Once you have an instance of Server, you can start manipulating the databases on your CouchDB server. To create a database: couchServer.CreateDatabase("test"); If Ottoman was not able to create a database, a CannotCreateDatabaseException will be thrown with the details of what happened. To delete a database: couchServer.DeleteDatabase("test"); 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(); couchDatabase.SaveDocument<Foo>(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 CouchDB. 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 http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- The Ottoman Dev Team http://sinesignal.com
About
Ottoman is an open-source CouchDB API for the .NET Framework written in C#.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- C# 96.7%
- Ruby 2.5%
- JavaScript 0.8%