File Maintenance: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Return to Programming Guide") |
No edit summary |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
# 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: | |||
<pre>public class FooProfile : Profile, IProfile | |||
{ | |||
public FooProfile() | |||
{ | |||
CreateMap<FooDTO, Foo>() | |||
.ForMember(dest => dest.NavigationalProperty, opt => opt.Ignore()); | |||
} | |||
}</pre> | |||
#<li value="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.</li> | |||
# 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]] | Return to [[Programming Guide]] |
Latest revision as of 15:21, 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