Created
February 21, 2013 11:21
-
-
Save yetanotherchris/5004059 to your computer and use it in GitHub Desktop.
ORMS: SOODA example
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
// This class is autogenerated by the Sooda designer, this is a shorter version as with the | |
// the Entity Framework example | |
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() | |
{ | |
// Requires app.config/web.config settings and the XML config file | |
using (SoodaTransaction transaction = new SoodaTransaction()) | |
{ | |
// Save example | |
Person person = new Person(); | |
person.Id = Guid.NewGuid(); | |
person.Name = "John"; | |
person.Email = "john@aol.com"; | |
transaction.Commit(); | |
// Load and filtering, HQL style syntax | |
IList<Person> list = Person.GetList(new SoodaWhereClause("Person.Name = 'John'")); | |
// A typed form of querying is also available, so that field names can be | |
// checked at compile time, avoiding runtime errors | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment