@@ -68,7 +68,7 @@ def __init__(self):
68
68
69
69
# Utilities
70
70
self .document_id_generator : Optional [Callable [[str , object ], str ]] = None
71
- self ._get_identity_property_name : Callable [[Type [Any ]], str ] = lambda type_ : "Id"
71
+ self ._find_identity_property_name : Callable [[Type [Any ]], str ] = lambda type_ : "Id"
72
72
self ._id_property_name_cache : Dict [Type , str ] = {}
73
73
self ._find_python_class : Optional [Callable [[str , Dict ], str ]] = None
74
74
self ._find_collection_name : Callable [[Type ], str ] = self .default_get_collection_name
@@ -225,6 +225,14 @@ def disable_atomic_document_writes_in_cluster_wide_transaction(self, value: bool
225
225
self ._assert_not_frozen ()
226
226
self ._disable_atomic_document_writes_in_cluster_wide_transaction = value
227
227
228
+ @property
229
+ def find_identity_property_name (self ) -> Callable [[Type [Any ]], str ]:
230
+ return self ._find_identity_property_name
231
+
232
+ @find_identity_property_name .setter
233
+ def find_identity_property_name (self , find_identity_property_name_function : Callable [[Type [Any ]], str ]):
234
+ self ._find_identity_property_name = find_identity_property_name_function
235
+
228
236
@staticmethod
229
237
def json_default (o ):
230
238
if o is None :
@@ -376,7 +384,7 @@ def clone(self) -> DocumentConventions:
376
384
cloned ._save_enums_as_integers = self ._save_enums_as_integers
377
385
cloned .identity_parts_separator = self .identity_parts_separator
378
386
cloned .disable_topology_updates = self .disable_topology_updates
379
- cloned ._get_identity_property_name = self ._get_identity_property_name
387
+ cloned ._find_identity_property_name = self ._find_identity_property_name
380
388
381
389
cloned .document_id_generator = self .document_id_generator
382
390
@@ -397,7 +405,7 @@ def get_identity_property_name(self, object_type: Type[Any]) -> Optional[str]:
397
405
if object_type in self ._id_property_name_cache :
398
406
return self ._id_property_name_cache [object_type ]
399
407
400
- id_property_name = self ._get_identity_property_name (object_type )
408
+ id_property_name = self .find_identity_property_name (object_type )
401
409
402
410
# Cache the result
403
411
self ._id_property_name_cache [object_type ] = id_property_name
0 commit comments