Skip to content

PolicyInformationService

Resolves basic display and classification facts about a policy or non-policy account number, reading non-policy accounts through IPolicyQueryProvider and full policies directly through IUnitOfWork.GetRepository<Policy>(), distinguishing the two by whether the numeric identifier is below 18 (a non-policy account) or 18 and above (a full policy).*

Purpose

  • Returns the display name for a policy or non-policy account number, sourcing non-policy accounts from IPolicyQueryProvider.GetNonPolicyAccount and full policies from the Policy repository.
  • Determines whether a policy's entity classification is StateEntity, used to distinguish state-government policyholders from other entity types.

Context

  • Namespace: SAIF.Services.Policies.Information
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package).

Public members

Member Signature Purpose
PolicyInformationService (constructor) public PolicyInformationService(IUnitOfWork unitOfWork, IPolicyQueryProvider policyQueryProvider) Wires the unit of work and policy query provider used to resolve policy/account name and entity data.
GetPolicyName public string GetPolicyName(long policyNumber) For numbers below 18, returns the AccountName of the matching non-policy account (or an empty string if none found); otherwise returns the PolicyName of the matching Policy (or an empty string if none found).
IsPolicyStateEntity public bool IsPolicyStateEntity(long policyNumber) Returns false for numbers below 18 (non-policy accounts are never state entities); otherwise returns true only if the matching policy's Entity.Code equals PolicyEntity.StateEntity.

Behavioral notes

  • The threshold of 18 used to distinguish non-policy accounts from full policies is a hard-coded numeric constant embedded directly in both methods rather than a named constant.*
  • Neither method throws when no matching record is found; both degrade to an empty string / false.

Constraints and usage notes

  • Constructor parameters are not null-checked (no Enforce.ArgumentNotNull calls), unlike most other services in the Policies area.*

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Services/SAIF.Services/Policies/Information/PolicyInformationService.cs