using NMemory.Constraints;
public static void Main()
MyDatabase myDatabase = new MyDatabase();
myDatabase.Groups.Insert(new Group() {Name = null});
myDatabase.Groups.Insert(new Group() {Name = "12345"});
myDatabase.Groups.Insert(new Group() {Id = 8, Name = "NotNull"});
FiddleHelper.WriteTable("All Groups", myDatabase.Groups.ToList());
public class MyDatabase : Database
var members = this.Tables.Create<Member, int>(x => x.Id);
var groups = this.Tables.Create<Group, int>(x => x.Id, new IdentitySpecification<Group>(x => x.Id, 1, 1));
RelationOptions options = new RelationOptions(
var peopleGroupIdIndex = members.CreateIndex(
new RedBlackTreeIndexFactory(),
this.Tables.CreateRelation(
groups.Contraints.Add(new NotNullableConstraint<Group, string>(x => x.Name));
public ITable<Member> Members { get; private set; }
public ITable<Group> Groups { get; private set; }
public int Id { get; set; }
public string Name { get; set; }
public int? GroupId { get; set; }
public int Id { get; set; }
public string Name { get; set; }