Created
February 21, 2013 11:26
-
-
Save yetanotherchris/5004085 to your computer and use it in GitHub Desktop.
ORMS: db4o
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
public class Person | |
{ | |
public Guid Id { get; set; } | |
public string Name { get; set; } | |
public string Email { get; set; } | |
} | |
public class PersonManager | |
{ | |
public static void Example() | |
{ | |
// Doesn't require app.config/web.config settings | |
IObjectContainer db = Db4oFactory.OpenFile("example.db"); | |
// Saving example | |
Person person = new Person(); | |
person.Id = Guid.NewGuid(); | |
person.Name = "John"; | |
person.Email = "john@aol.com"; | |
db.Store(person); | |
db.Close(); | |
// Query example | |
db = Db4oFactory.OpenFile("example.db"); | |
IList<Person> list = db.Query<Person>(p => p.Name == "John"); | |
db.Close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment