-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathedmx-parser.ts
40 lines (34 loc) · 1 KB
/
edmx-parser.ts
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
import {
parseComplexTypesBase,
parseEntitySetsBase,
parseEntityTypesBase
} from '../common/edmx-parser';
import { EdmxEntitySetBase } from '../common';
import { forceArray } from '../../generator-utils';
import {
EdmxAssociation,
EdmxAssociationSet,
EdmxEntityType,
EdmxFunctionImport
} from './edm-types';
export function parseComplexTypes(root) {
return parseComplexTypesBase(root);
}
export function parseEntitySets(root): EdmxEntitySetBase[] {
return parseEntitySetsBase(root);
}
export function parseEntityTypes(root): EdmxEntityType[] {
return parseEntityTypesBase(root);
}
export function parseAssociation(root): EdmxAssociation[] {
return forceArray(root.Association);
}
export function parseAssociationSets(root): EdmxAssociationSet[] {
return forceArray(root.EntityContainer.AssociationSet);
}
export function parseFunctionImports(root): EdmxFunctionImport[] {
return forceArray(root.EntityContainer.FunctionImport).map(f => ({
...f,
Parameter: forceArray(f.Parameter)
}));
}