In researching the SubSonic's new SimpleRepository, I've found that calling the Update() method always throws a NullReferenceException. This is even true in the sample MVC download that's included with the 3.0.0.3 release.
Does anyone know if there's a way to get updates to succeed?
Here's an example. The if statement works; it adds the table and creates the record. Running this code a second time flow to the else block, and the update throws the exception.
var repo = new SimpleRepository("c", SimpleRepositoryOptions.RunMigrations);
var user = repo.Single<User>(u => u.Email == "[email protected]");
if (user == null)
{
repo.Add(new User { Email = "[email protected]", Name = "Test" });
}
else
{
user.Name = DateTime.Now.ToString();
repo.Update(user);
}
public class User
{
public int Key { get; set; }
public string Name { get; set; }
public string Email { get; set; }
}