If you have an interface for a repository that includes
T Add( T entity);
The Repository wouldn't include a Save() or SaveChanges(). If you were to return "entity" with:
return _dc.Entities.Where( n => n.ID == entity.ID).Single();
I wouldn't expect this to hit the database and auto-generate identity values (auto-incrementing). Two questions:
- What values would be in the fields for ID assuming it is an identity (auto-incrementing) field?
- When this actually does save, can we expect the identity fields to automatically update in the returned object?
- Is there a command that will update object references from the database outside a repository?
This is using ASP.NET POCO Generator for Entity Framework 4 with virtual properties.