Skip to content

Instantly share code, notes, and snippets.

@codeinvain
Created June 10, 2010 12:02
Show Gist options
  • Save codeinvain/432888 to your computer and use it in GitHub Desktop.
Save codeinvain/432888 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raven.Client.Document;
using Raven.Client;
using HelloRaven.model;
namespace HelloRaven
{
class Program
{
static void Main(string[] args)
{
// create new DB object and provide it with a "connection string"
DocumentStore dc = new DocumentStore() { Url = "http://localhost:8080" };
// open connection
dc.Initialize();
// open session (unit of work mentality)
IDocumentSession session = dc.OpenSession();
var ch1 = new Channel() { Name = "MTV" };
session.Store(ch1);
//Raven DB automatically sets Id value
Console.WriteLine("Channel Id '" + ch1.Id + "'");
session.SaveChanges();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment