@@ -50,10 +50,11 @@ export class DocumentConventions {
5050
5151 private _transformClassCollectionNameToDocumentIdPrefix : ( maybeClassCollectionName : string ) => string ;
5252 private _documentIdGenerator : IdConvention ;
53- private _findIdentityPropertyNameFromCollectionName : ( collectionName : string ) => string ;
5453
5554 private _findCollectionName : ( constructorOrTypeChecker : ObjectTypeDescriptor ) => string ;
5655
56+ private _identityProperty : string ;
57+
5758 private _findJsTypeName : ( ctorOrTypeChecker : ObjectTypeDescriptor ) => string ;
5859 private _findJsType : ( id : string , doc : object ) => ObjectTypeDescriptor ;
5960
@@ -77,8 +78,7 @@ export class DocumentConventions {
7778 public constructor ( ) {
7879 this . _readBalanceBehavior = "None" ;
7980 this . _identityPartsSeparator = "/" ;
80-
81- this . _findIdentityPropertyNameFromCollectionName = ( ) => "id" ;
81+ this . _identityProperty = CONSTANTS . Documents . Metadata . ID_PROPERTY ;
8282
8383 this . _findJsType = ( id : string , doc : object ) => {
8484 const metadata = doc [ CONSTANTS . Documents . Metadata . KEY ] ;
@@ -271,6 +271,15 @@ export class DocumentConventions {
271271 this . _useOptimisticConcurrency = useOptimisticConcurrency ;
272272 }
273273
274+ public get identityProperty ( ) {
275+ return this . _identityProperty ;
276+ }
277+
278+ public set identityProperty ( val ) {
279+ this . _assertNotFrozen ( ) ;
280+ this . _identityProperty = val ;
281+ }
282+
274283 public get findJsType ( ) {
275284 return this . _findJsType ;
276285 }
@@ -298,15 +307,6 @@ export class DocumentConventions {
298307 this . _findCollectionName = value ;
299308 }
300309
301- public get findIdentityPropertyNameFromCollectionName ( ) {
302- return this . _findIdentityPropertyNameFromCollectionName ;
303- }
304-
305- public set findIdentityPropertyNameFromCollectionName ( value ) {
306- this . _assertNotFrozen ( ) ;
307- this . _findIdentityPropertyNameFromCollectionName = value ;
308- }
309-
310310 public get documentIdGenerator ( ) {
311311 return this . _documentIdGenerator ;
312312 }
@@ -500,7 +500,7 @@ export class DocumentConventions {
500500 public getIdentityProperty ( documentType : DocumentType ) : string {
501501 const typeDescriptor = this . getJsTypeByDocumentType ( documentType ) ;
502502 return this . _registeredIdPropertyNames . get ( typeDescriptor )
503- || CONSTANTS . Documents . Metadata . ID_PROPERTY ;
503+ || this . _identityProperty ;
504504 }
505505
506506 public updateFrom ( configuration : ClientConfiguration ) : void {
0 commit comments