Created
May 19, 2013 12:37
-
-
Save PureKrome/5607527 to your computer and use it in GitHub Desktop.
PLaying around with RavenDb and sessions.
This file contains 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.Linq; | |
using Raven.Client.Document; | |
namespace ConsoleApplication7 | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var documentStore = new DocumentStore | |
{ | |
Url = "http://localhost:8080", | |
DefaultDatabase = "abcdefg" | |
}; | |
documentStore.Initialize(); | |
using (var session = documentStore.OpenSession()) | |
{ | |
session.Store(new Foo | |
{ | |
Name = "fred" | |
}); | |
var x = session.Query<Foo>().ToList(); | |
// Count is 0, not 1. | |
Console.WriteLine(x.Count); | |
} | |
documentStore.Dispose(); | |
} | |
} | |
public class Foo | |
{ | |
public string Id { get; set; } | |
public string Name { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment