Created
June 10, 2010 12:02
-
-
Save codeinvain/432888 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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