Let's say I've got the following ActiveRecord class:
[ActiveRecord]
public class Account
{
...
[BelongsTo("CustomerId")]
public Customer Customer { get; set; }
}
Currently, to set the value of the CustomerId field I have to get the entire Customer object from the database and assign it to the Account:
Customer customer = Customer.FindById(1);
account.Customer = customer;
This isn't very efficient. I'd rather set the value of CustomerId field directly without round-tripping the database, e.g.
account.CustomerId = 1;
What's the correct way to do this?