File Maintenance: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
}</pre> | }</pre> | ||
< | #<li value="3"> 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.</li> | ||
# Create the service interface in Novus.Business project in the Interfaces directory. | # Create the service interface in Novus.Business project in the Interfaces directory. | ||
# Create the service implementation directly under Novus.Business. | # Create the service implementation directly under Novus.Business. |
Revision as of 15:20, 10 October 2023
- Create the entity class in the Novus.Model.Entity project.
- Optionally, implement the audit fields as described in the Database section.
- Optionally, implement the version field as described in the Optimistic Concurrency Control section.
- 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.
- 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()); } }
- 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.
- Create the service interface in Novus.Business project in the Interfaces directory.
- Create the service implementation directly under Novus.Business.
- Create the controller.
- Create the TypeScript class that has the same properties as the DTO.
- Create the SFC.
Return to Programming Guide