generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathntangle.yaml
93 lines (90 loc) · 5.1 KB
/
ntangle.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
schema: Legacy # Defaults the schema for the non-CDC related tables.
cdcSchema: NTangle # Defines the name of the schema to be used for CDC-related artefacts.
cdcSchemaCreate: true # Indicates whether to create the CDC database schema via code-generation.
cdcEnable: true # Indicates whether to enable CDC for the referenced table(s) in the database.
eventSourceRoot: /database/cdc # Event source URI root prepended to all published events.
eventSubjectRoot: Legacy # Event subject root prepended to all published events.
outbox: true # Indicates to include the generation of the event outbox artefacts.
outboxSchemaCreate: true # Indicates whether to create the Outbox database schema via code-generation.
identifierMapping: true # Indicates to include the generation of the global identifier mapping artefacts.
excludeColumnsFromETag: [ RowVersion ] # Default list of columns to exclude from the generated ETag (exclude from version tracking).
service: HostedService # Create the entity-based hosted services to be executed by the likes of a console application.
tables:
# Set up CDC for primary table Legacy.Posts.
# Relational hierarchy: Legacy.Posts
# - Legacy.Comments (1:n)
# - Legacy.Tags (1:n)
# - Legacy.Tags (1:n).
- { name: Posts, model: Post, eventSourceFormat: NameOnly, eventSubjectFormat: NameAndKey,
joins: [
# Set up secondary One-To-Many relationship from Legacy.Posts to Legacy.Comments (1:n).
# Join on Comments.PostsId = Posts.PostsId.
# The .NET model should be singular in name.
{ name: Comments, model: Comment, joinTo: Posts, excludeColumns: [ PostsId ],
on: [
{ name: PostsId, toColumn: PostsId }
]
},
# Set up secondary One-To-Many relationship from Legacy.Comments to Legacy.Tags (1:n).
# Name as 'CommentTag' for uniqueness for join referencing.
# Exclude the 'ParentType' column as not necessary for publishing (i.e. internal to database).
# Rename 'ParentId' column to `CommentsId`.
# Join on Tags.ParentType = 'C' AND Tags.ParentId = Comments.CommentsId.
{ name: CommentsTags, table: Tags, Property: Tags, joinTo: Comments, excludeColumns: [ ParentType, ParentId ],
on: [
{ name: ParentType, toStatement: '''C''' },
{ name: ParentId, toColumn: CommentsId }
]
},
# Set up secondary One-To-Many relationship from Legacy.Posts to Legacy.Tags (1:n).
# Name as 'PostTag' for uniqueness for join referencing.
# Exclude the 'ParentType' column as not necessary for publishing (i.e. internal to database).
# Rename 'ParentId' column to `PostsId`.
# Join on Tags.ParentType = 'P' AND Tags.ParentId = Posts.PostsId.
{ name: PostsTags, table: Tags, Property: Tags, joinTo: Posts, excludeColumns: [ ParentType, ParentId ], aliasColumns: [ ParentId^PostsId ],
on: [
{ name: ParentType, toStatement: '''P''' },
{ name: ParentId, toColumn: PostsId }
]
}
]
}
# Set up CDC for primary table Legacy.Contact.
- { name: Contact, eventSubject: Contact, identifierMapping: true, aliasColumns: [ ContactId^CID ], excludeColumnsFromETag: [ legacy_system_code ], PartitionKey: Contact,
joins: [
# Set up secondary One-To-One relationship from Legacy.Contact to Legacy.Address (1:1).
# Join on Address.AddressId = Contact.AddressId.
# Dynamically adjust the query size using the specified multiplier.
# Add global identifier mapping.
# Alias, change name of, Id column to AID.
{ name: Address, joinCardinality: OneToOne, querySizeMultiplier: 1.5, identifierMapping: true, identifierMappingColumns: [ AlternateAddressId^Address ], aliasColumns: [ AddressId^AID ],
on: [
{ name: AddressId }
],
mappings: [
{ name: AlternateAddressId, table: Address }
]
},
# Set up inner join relationship from Legacy.Contact to Legacy.ContactMapping.
# Left Outer Join (does not have to exist) on ContactMapping.ContactId = Contact.ContactId.
# Only include the joined 'UniqueId' column.
{ name: ContactMapping, type: Left, includeColumns: [ UniqueId ],
on: [
{ name: ContactId }
]
}
],
mappings: [
{ name: AlternateContactId, table: Contact }
]
}
# Set up CDC for primary table Legacy.Cust; however, reference as Customer.
# Override the default column name to light-up the IsDeleted capability.
# Exclude the secret and private columns to ensure not sent.
# Where clause to exclude private customers.
# RowVersion column will be excluded as per root config.
- { name: Customer, table: Cust, aliasColumns: [ CustId^Id ], isDeletedColumn: is-deleted, excludeColumns: [ internal-secret, is-private ],
where: [
{ name: is-private, nullable: ISNULL, value: '0' }
]
}