Persistence ignorance and custom models
So far, we have used generated classes as our models. We will now look at creating a custom model and will add persistence ignorance to our design.
Trade-offs of generated models
The Microsoft technology stack provides plenty of solutions that allow for getting up and running with models that support change notifications via INotifyPropertyChanged
. As with everything in software development, there are trade-offs to be considered when determining what type of architecture you need; the advantages and disadvantages of using generated models are shown as follows:
Advantages |
Disadvantages |
---|---|
Quick to develop | Couples Presentation with data access |
Models are generated for you | Changing data access requires difficult refactoring of presentation code. |
Generated code for change notification | Encourages database centric model |
You should be familiar with the advantages listed previously at this point, so let's talk a bit about the disadvantages. When we needed to change...