Skip to content

Inconsistent StartupType default: Manual in Repository vs Automatic in Mapper #291

@Christophe-Rogiers

Description

@Christophe-Rogiers

Description

Two different mappers assign different defaults when StartupType is null:

ServiceRepository.MapToDomain (src/Servy.Infrastructure/Data/ServiceRepository.cs, line 632):

StartupType = dto.StartupType.HasValue ? (ServiceStartType)dto.StartupType.Value : ServiceStartType.Manual,

ServiceMapper.ToDomain (src/Servy.Core/Mappers/ServiceMapper.cs, line 101):

StartupType = dto.StartupType == null ? ServiceStartType.Automatic : (ServiceStartType)dto.StartupType,

Both methods map ServiceDto → domain Service, but one defaults to Manual and the other to Automatic. The behavior depends on which code path is taken.

Severity

Warning — inconsistent behavior depending on code path.

Suggested fix

Align both mappers to the same default value and consider extracting the default to a shared constant.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions