File Maintenance: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
# Create the entity class in the Novus.Model.Entity project. | # Create the entity class in the Novus.Model.Entity project. | ||
## Optionally, implement the audit fields as described in the Database section. | |||
b. Optionally, implement the version field as described in the Optimistic Concurrency Control section. | b. Optionally, implement the version field as described in the Optimistic Concurrency Control section. | ||
2. Create the corresponding DTO in Novus.Model.DTO project. Make sure to copy all the properties (including the navigational properties / dependent collections) of the entity to the DTO or AutoMapper will not work for that entity. | 2. Create the corresponding DTO in Novus.Model.DTO project. Make sure to copy all the properties (including the navigational properties / dependent collections) of the entity to the DTO or AutoMapper will not work for that entity. |
Revision as of 15:10, 10 October 2023
- Create the entity class in the Novus.Model.Entity project.
- Optionally, implement the audit fields as described in the Database section.
b. Optionally, implement the version field as described in the Optimistic Concurrency Control section. 2. Create the corresponding DTO in Novus.Model.DTO project. Make sure to copy all the properties (including the navigational properties / dependent collections) of the entity to the DTO or AutoMapper will not work for that entity. 3. If the entity has a navigational property, and the DTO doesn't, create a AutoMapper profile in Novus.Model.Mapper project: public class FooProfile : Profile, IProfile {
public FooProfile() { CreateMap<FooDTO, Foo>() .ForMember(dest => dest.NavigationalProperty, opt => opt.Ignore()); }
} 4. Add a property to get the repository for the entity in the IUnitOfWork interface and implementation in the Novus.DataAccess project. The unit of work is not a good abstraction to use since the underlying DbContext is already a unit of work itself. 5. Create the service interface in Novus.Business project in the Interfaces directory. 6. Create the service implementation directly under Novus.Business. 7. Create the controller. 8. Create the TypeScript class that has the same properties as the DTO. 9. Create the SFC.
Return to Programming Guide