@@ -50,10 +50,11 @@ export class DocumentConventions {
50
50
51
51
private _transformClassCollectionNameToDocumentIdPrefix : ( maybeClassCollectionName : string ) => string ;
52
52
private _documentIdGenerator : IdConvention ;
53
- private _findIdentityPropertyNameFromCollectionName : ( collectionName : string ) => string ;
54
53
55
54
private _findCollectionName : ( constructorOrTypeChecker : ObjectTypeDescriptor ) => string ;
56
55
56
+ private _identityProperty : string ;
57
+
57
58
private _findJsTypeName : ( ctorOrTypeChecker : ObjectTypeDescriptor ) => string ;
58
59
private _findJsType : ( id : string , doc : object ) => ObjectTypeDescriptor ;
59
60
@@ -77,8 +78,7 @@ export class DocumentConventions {
77
78
public constructor ( ) {
78
79
this . _readBalanceBehavior = "None" ;
79
80
this . _identityPartsSeparator = "/" ;
80
-
81
- this . _findIdentityPropertyNameFromCollectionName = ( ) => "id" ;
81
+ this . _identityProperty = CONSTANTS . Documents . Metadata . ID_PROPERTY ;
82
82
83
83
this . _findJsType = ( id : string , doc : object ) => {
84
84
const metadata = doc [ CONSTANTS . Documents . Metadata . KEY ] ;
@@ -271,6 +271,15 @@ export class DocumentConventions {
271
271
this . _useOptimisticConcurrency = useOptimisticConcurrency ;
272
272
}
273
273
274
+ public get identityProperty ( ) {
275
+ return this . _identityProperty ;
276
+ }
277
+
278
+ public set identityProperty ( val ) {
279
+ this . _assertNotFrozen ( ) ;
280
+ this . _identityProperty = val ;
281
+ }
282
+
274
283
public get findJsType ( ) {
275
284
return this . _findJsType ;
276
285
}
@@ -298,15 +307,6 @@ export class DocumentConventions {
298
307
this . _findCollectionName = value ;
299
308
}
300
309
301
- public get findIdentityPropertyNameFromCollectionName ( ) {
302
- return this . _findIdentityPropertyNameFromCollectionName ;
303
- }
304
-
305
- public set findIdentityPropertyNameFromCollectionName ( value ) {
306
- this . _assertNotFrozen ( ) ;
307
- this . _findIdentityPropertyNameFromCollectionName = value ;
308
- }
309
-
310
310
public get documentIdGenerator ( ) {
311
311
return this . _documentIdGenerator ;
312
312
}
@@ -500,7 +500,7 @@ export class DocumentConventions {
500
500
public getIdentityProperty ( documentType : DocumentType ) : string {
501
501
const typeDescriptor = this . getJsTypeByDocumentType ( documentType ) ;
502
502
return this . _registeredIdPropertyNames . get ( typeDescriptor )
503
- || CONSTANTS . Documents . Metadata . ID_PROPERTY ;
503
+ || this . _identityProperty ;
504
504
}
505
505
506
506
public updateFrom ( configuration : ClientConfiguration ) : void {
0 commit comments