The Entity (DTO) is primarily responsible for defining the domain-based model (and contract where accessible externally over-the-wire). They are also used to define the reference data model.
The aim here is decouple this definition, where applicable, from the underlying data source. This is likely to be defined differently, with an alternate naming convention, alternate shape/structure, etc. This also enables the data source to evolve independently of this model, as well as possibly hide additional implementaion details.
The key Beef entity capabilities are enabled primarily by the Beef.Entities
namespace.
A code-generated entity will get the following capabilities by default:
- Inherit from EntityBase or ReferenceDataBase
- Support for INotifyPropertyChanged.
- Support for IEditableObject.
- Support for ICloneable.
- Support for ICopyFrom.
- Support for ICleanUp.
- Support for IUniqueKey.
- Corresponding collection inheriting from EntityBaseCollection or ReferenceDataCollectionBase
Other optional interfaces can also be implemented:
- Support for IIdentifier
- Support for IETag.
- Support for IChangeLog.
The Entity
and its corresponding Property
elements within the entity.xml
configuration primarily drives the output. There is a generated class per Entity
with the same name.
The sample Person
demonstrates the richness of the generated output.