I'm building a small timing application using the MVVM pattern, using entity framework for persistence. At this stage, my logic is pretty thin, as I only need to perform a few calculations and aggregations on related data. At the moment, I have implemented these by writing them in a partial class of the entity class.
For example:
// entity framework generated
partial class Lap {
int Id { /* boilerplate */ }
DateTime StartTime { /* etc */ }
DateTime EndTime { /* etc */ }
}
// in my partial class (written by me)
partial class Lap {
TimeSpan Duration {
get { return EndTime - StartTime; }
}
}
Is it bad practice to drop extra logic straight onto the entity-generated classes? Should I make another domain layer for this logic?