🔏
Azure Serverless Quickstart
  • Introduction
  • Initial Setup
    • Workstation Installs
    • Codebase
      • Directory Structure
      • User Interface Project
        • Configuring StoryBook
        • Configure Tailwind
        • Configure Craco
        • -Architectural Decision Log
      • Data Access Project
        • DDD
      • Untitled
      • Full Stack Debugging
      • Creating GitHub Project
    • Infrastructure
      • Configure Session Behavior
      • Create AAD Tenant
      • Resource Group
      • Create AAD B2C Instance
        • Identity Experience Framework
        • Configure Session Behavior
      • Storage Account & CDN
        • CDN Rules
        • Configure Azure BLOB Storage
      • App Insights
        • Create AppInsight Account
        • Apollo GraphQL App Insights Configuration
      • CosmosDB
      • Twilio SendGrid
      • KeyVault
      • Function
      • Function App Settings
      • Front Door
      • DevOps
      • Optional Items
        • Azure Data Factory
      • Azure Event Hub
    • CICD and Source Control
      • Azure DevOps
      • SonarCloud
        • Incorporate into Yaml
      • Chromatic
      • User Interface YAML
      • CICD for Data Access
        • Create Pipeline
        • Data Access YAML
  • Application Structure
    • Connect Apollo
      • Apollo Overview
      • Create Apollo Component
    • MongoDB Integration
      • Mappings
      • Directory Structure
      • Apollo Connection
      • Models
      • Queries Mutations and Subscriptions
      • Caching Reponses
    • Integrating GraphQL Tools
      • GraphQL Code Generator
    • Feature Flags
      • Flag Structure & Storage
      • Website Integration
      • Apollo Integration
      • Tips and Techniques
      • Alternative Approaches
    • React Router
    • Adding Authentication
      • Create AAD Applications
      • Configure AAD For External Identities
      • Adding MSAL And React
      • Add MSAL to the build
      • Add MSAL to ApolloClient
      • Add MSAL to ApolloServer
    • Ant Design
    • Jest Tests
  • Azure Active Directory Business-to-Consumer (AD B2C)
    • Introduction
    • How to navigate through AD B2C documentation
    • Localization
    • Abbreviations
    • Azure AD B2C Extension
  • Cognitive Search
  • Cost Analysis
  • Technical Architecture
    • Identity and Access Control
  • Adding Functionality
    • Google Analytics
      • Create Analytics
    • DAPR
      • DAPR setup
      • DAPR Services (ignore for now)
        • Identity
  • Patterns and Practices
    • Idempotent Messages
    • Pathways
    • DDD
      • Initial Setup
        • Aggregate Root
        • Entity
        • Value Object
      • Field Types
        • Primitive Types
        • Non-Primitive Types
          • Types.DocumentArray
          • PopulatedDoc
          • Custom Types
      • Example Walkthrough
  • Open Items
    • Issue Tracking
  • Helpful Resources
  • DDD
    • Page 1
  • Experimental
    • StaticWebApp
    • Azure Maps
Powered by GitBook
On this page
  • Cosmos DB Model
  • Domain Context
  • Domain Adapter

Was this helpful?

  1. Patterns and Practices
  2. DDD
  3. Initial Setup

Value Object

If the cosmos db interface extends NestedPath, it is a Value Object on domain side

Cosmos DB Model

/infrastructure/data-sources/cosmos-db/models/minicex.ts
export interface MinicexRequest extends NestedPath {

Each value object requires:

  • Domain Context file

  • Domain Adapter

Domain Context

/domain/contexts/new-application/minicex-request.ts
import { ValueObject, ValueObjectProps } from "../../shared/value-object";
import { DomainExecutionContext } from "../context";

export interface MinicexRequestProps extends ValueObjectProps{
  // Add fields according to the model
}

export interface MinicexRequestEntityReference extends Readonly<MinicexRequestProps> {}

export class MinicexRequest
  extends ValueObject<MinicexRequestProps> implements MinicexRequestEntityReference {
  constructor(props: props, private readonly context: DomainExecutionContext) { 
    super(props);
  }
  // Add getters and setters for the field that was mentioned/defined above
}
  • domain context file in same directory as context file of aggregate root it belongs to

  • in this example, minicex.ts is in /domain/contexts/new-application/ so minicex-request.ts is also in new-application/ directory

Domain Adapter

export class MinicexRequestDomainAdapter implements MinicexRequestProps {
  constructor(private readonly props: MinicexRequest) {}
  
  // Add getters and setters for the field that was mentioned/defined in Domain Context file
}
  • domain adapter in same file as domain adapter of aggregate root

  • if too many adapters in one file, can split out into multiple files as needed

  • in this example, MinicexRequestDomainAdapter goes in minicex.domain-adapter.ts

  • Note: argument in constructor is called props instead of doc

PreviousEntityNextField Types

Last updated 2 years ago

Was this helpful?