Skip to content

CertificateHolder

CertificateHolder wraps a certData.CertificateHolder entity and implements the certificate-holder lifecycle for OP-DOM-17: a new certificate holder is created directly from a CertificateHolderEdit contract, an existing one is updated the same way, and its expired/superseded flags are toggled by dedicated methods that stamp the acting user and timestamp (DOM-BR-170–DOM-BR-172).

Purpose

  • Creates a brand-new certificate holder from a CertificateHolderEdit contract, mapping every editable field (name, address, phone/fax, email) onto the entity and stamping create/update user and date, then adds it to the repository.
  • Updates an existing certificate holder in place from a CertificateHolderEdit contract, re-mapping the same fields and stamping the update user/date.
  • Expires, reinstates, and supersedes a certificate holder, each toggling the relevant flag and stamping the update user/date (DOM-BR-170–DOM-BR-172).

Context

  • Namespace: SAIF.Domain.Model.Policies.Certificates
  • Assembly/package: SAIF.Domain (packaged in SAIF.SAIFCode.Core)

Public members

Member Signature Purpose
CertificateHolder (constructor by id) public CertificateHolder(IRepositoryFactory factory, string userId, long id) Loads the certificate holder identified by id and captures userId as the acting user for future updates.
CertificateHolder (constructor, create from edit) public CertificateHolder(IRepositoryFactory factory, string userId, CertificateHolderEdit certificateHolderEdit) Creates a new certificate holder entity, maps certificateHolderEdit onto it, stamps create/update user (userId) and date, and adds it to the repository.
CertificateHolder (constructor, update from edit) public CertificateHolder(IRepositoryFactory factory, string userId, long id, CertificateHolderEdit certificateHolderEdit) Loads the certificate holder identified by id, re-maps certificateHolderEdit onto it, and stamps the update user (userId) and date.
Data public certData.CertificateHolder Data { get; } Exposes the underlying certificate-holder entity.
Expire public void Expire() Sets IsExpired to true and stamps the update user/date (DOM-BR-170).
Reinstate public void Reinstate() Sets IsExpired to false and stamps the update user/date (DOM-BR-171).
Supersede public void Supersede(certData.CertificateHolder newCertficateHolder) Links newCertficateHolder as the record that supersedes this one, sets IsSuperseded to true, and stamps the update user/date (DOM-BR-172).

Inherited public members

Members in this section are inherited from DomainBase<TItem> in SAIF.Domain. They are available on this type through inheritance (via the intermediate DomainRepositoryBase<TItem> base).

Member Signature Purpose Origin
HasData public virtual bool HasData { get; } Reports whether the wrapped certificate-holder entity is present, evaluated as !DataItem.IsNull(). SAIF.Domain — DomainBase<TItem>

Behavioral notes

  • Only the constructor-by-id overload chains to : base(factory); the two edit-based constructors do not call a base constructor with factory, so they run against DomainRepositoryBase<TItem>'s internal parameterless constructor and leave the protected Factory field unset on those code paths — meaning any later code path on those instances that depends on Factory would find it null*.
  • The country code is only overwritten from the edit contract when the certificate holder IsForeign; otherwise it is hard-coded to "US", regardless of what the edit contract's CountryCode was (DOM-BR-170).
  • Address text fields are passed through ReplaceUnicodeCharacters, converting Unicode characters to their ASCII equivalents before persisting, likely to satisfy a downstream system's character-set constraints*.

Constraints and usage notes

  • Callers using the two edit-based constructors should be aware that Factory is not set on the resulting instance (see behavioral note above); any subsequent repository operation through Factory on those instances would not function as expected.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Domain/SAIF.Domain/Model/Policies/Certificates/CertificateHolder.cs
  • Domain/SAIF.Domain/DomainBase.cs
  • Domain/SAIF.Domain/DomainRepositoryBase.cs