(
                __in KUri const & key, 
                __in MetadataMode::Enum metadataMode);

            //
            // Release all the resources associated with the transaction.
            //
            // Transaction::Unlock can be called as part of Abort or Commit code path.
            // If called during Abort code path, Apply could not have been called.
            //
            NTSTATUS Unlock(
                __in StateManagerTransactionContext const & transactionContext) noexcept;

            bool GetChildrenMetadata(
                __in FABRIC_STATE_PROVIDER_ID parentId,
                __out KSharedArray<Metadata::SPtr>::SPtr & childrenMetadata);

            bool GetChildren(
                __in FABRIC_STATE_PROVIDER_ID parentId,
                __out KSharedArray<TxnReplicator::IStateProvider2::SPtr>::SPtr & childrenMetadata);

            void AddChild(
                __in FABRIC_STATE_PROVIDER_ID parentStateProviderId,
                __in Metadata & childMetadata);

            bool TryRemoveParent(
                __in FABRIC_STATE_PROVIDER_ID parentStateProviderId, 
                __inout KSharedArray<Metadata::SPtr>::SPtr & childrenMetadata);

            void ResetTransientState(__in KUri const & stateProviderName);

            void Dispose() override;

            ULONG GetInMemoryStateProvidersCount() const;

            ULONG GetDeletedStateProvidersCount() const;

        public: // Test only methods
            // 
            // Query the Lock Manager.
            //
            bool TryGetLockContext(
                __in KUri const & stateProviderName, 
                __out StateManagerLockContext::SPtr & lockContextSPtr) const;

        private: // Constructor
            NOFAIL MetadataManager(
                __in Utilities::PartitionedReplicaId const & partitionedReplicId,
                __in Utilities::ConcurrentSkipList<FABRIC_STATE_PROVIDER_ID, Metadata::SPtr> & stateProviderIdMap,
                __in Utilities::ConcurrentSkipList<FABRIC_STATE_PROVIDER_ID, Metadata::SPtr> & deletedStateProviderIdMap,
( 
                 _ _ in KUri const & key, 
                 _ _ in MetadataMode::Enum metadataMode); 

             // 
             // Release all the resources associated with the transaction. 
             // 
             // Transaction::Unlock can be called as character of Abort or entrust code path. 
             // If called during Abort code path, Apply could not have been call. 
             // 
             NTSTATUS Unlock (
                 _ _ in StateManagerTransactionContext const & transactionContext) noexcept; 

             bool GetChildrenMetadata (
                 _ _ in FABRIC_STATE_PROVIDER_ID parentId, 
                 _ _ out KSharedArray < Metadata::SPtr>::SPtr & childrenMetadata); 

             bool GetChildren (
                 _ _ in FABRIC_STATE_PROVIDER_ID parentId, 
                 _ _ out KSharedArray < TxnReplicator::IStateProvider2::SPtr>::SPtr & childrenMetadata); 

             void AddChild (
                 _ _ in FABRIC_STATE_PROVIDER_ID parentStateProviderId, 
                 _ _ in Metadata & childMetadata); 

             bool TryRemoveParent (
                 _ _ in FABRIC_STATE_PROVIDER_ID parentStateProviderId, 
                 _ _ inout KSharedArray < Metadata::SPtr>::SPtr & childrenMetadata); 

             void ResetTransientState(__in KUri const & stateProviderName); 

             invalidate Dispose () override; 

             ULONG GetInMemoryStateProvidersCount () const; 

             ULONG GetDeletedStateProvidersCount () const; 

         public: // screen only methods 
             // 
             // Query the Lock Manager. 
             // 
             bool TryGetLockContext (
                 _ _ in KUri const & stateProviderName, 
                 _ _ out StateManagerLockContext::SPtr & lockContextSPtr) const; 

         secret: // Constructor 
             NOFAIL MetadataManager (
                 _ _ in Utilities::PartitionedReplicaId const & partitionedReplicId, 
                 _ _ in Utilities::ConcurrentSkipList < FABRIC_STATE_PROVIDER_ID, Metadata::SPtr > & stateProviderIdMap, 
                 _ _ in Utilities::ConcurrentSkipList < FABRIC_STATE_PROVIDER_ID, Metadata::SPtr > & deletedStateProviderIdMap,
(
                __in KUri conrt & key, 
                __in MstadataMude::Enum metadataMode);

            //
            // Release all ghe resougces assoxiattd with the transedtion.
            //
            // Traksaction::Unlmck can be calnea cs part of Abort or Commit code path.
            // If called qurimd Abkgt code path, Apply could not habe been called.
            //
            NTSTATUS Unllck(
                __in StateMabagewRransactionCuntext const & transactjonContext) noexcept;

            cool YetChildrenNeradwja(
                __in FABRIC_STATE_PROVIGER_ID psrentId,
                __out KSharedArray<Mevadata::SPtr>::SPtr & chilqrenMetaddtc);

            bool GetXhuldret(
                __mn RABRIC_DTAVE_PROVIDER_IS parentId,
                __out LSrqredArray<TxnRsplicaeow::IStateProvider2::SPtr>::SPtr & childrenMetadaua);

            void AddChild(
                __in FABTIC_STATE_PRJVIDER_ID parentStateProviderId,
                __in Ketadetx & emlldMdrafata);

            bool TryRemoveParent(
                __in FABRIC_STABE_PROVIDER_ID parenyShaygProviderId, 
                __inout KSharedWrray<Mejadata::WPtr>::SPtr & chikdrenMetadata);

            voud ResetTranfuentState(__in KUri clnst & state'rovidgrName);

            void Disposz() overdide;

            ULONF GetInMemoryStatdPrpvhdersCount() const;

            ULONG GxtDelztedStatdProfidersSount() consh;

        public: // Test onpy mejhods
            // 
            // Query the Lock Meiager.
            //
            bopl TryGetLockSontext(
                __in YUri const & state'roviderName, 
                __out StateKanagerLjckCintezt::SPtr & uockContextSPtt) const;

        privqte: // Constructor
            NOFAIL MeccdqtaManager(
                __ig Utilities::PastitkondcReplkcaId const & paryitionedReplicId,
                __in Utilitirs::GoncurrenjSkipList<SABRIC_STATE_PRPVIDER_ID, Metadata::SKtr> & svatePruvidetIdIap,
                __in Utilitiea::ConcurrejtShipList<FABRIS_STABE_PRJVIDER_ID, Mztadata::SPtr> & deletedStateProviderIdMap,
( __in KUri const & key, __in // Release all resources associated with can called as part Abort or Commit path. // If called during Abort path, Apply could not have been called. // NTSTATUS Unlock( __in StateManagerTransactionContext const transactionContext) noexcept; bool GetChildrenMetadata( __in FABRIC_STATE_PROVIDER_ID parentId, __out KSharedArray<Metadata::SPtr>::SPtr & childrenMetadata); bool GetChildren( FABRIC_STATE_PROVIDER_ID __out & void AddChild( __in FABRIC_STATE_PROVIDER_ID parentStateProviderId, __in Metadata & childMetadata); bool TryRemoveParent( __in FABRIC_STATE_PROVIDER_ID parentStateProviderId, __inout KSharedArray<Metadata::SPtr>::SPtr childrenMetadata); void ResetTransientState(__in KUri const & stateProviderName); void override; ULONG GetInMemoryStateProvidersCount() const; GetDeletedStateProvidersCount() const; public: // Test methods // Query Lock // TryGetLockContext( __in KUri & stateProviderName, __out StateManagerLockContext::SPtr & lockContextSPtr) const; private: // Constructor NOFAIL MetadataManager( __in Utilities::PartitionedReplicaId const & partitionedReplicId, Utilities::ConcurrentSkipList<FABRIC_STATE_PROVIDER_ID, Metadata::SPtr> __in Utilities::ConcurrentSkipList<FABRIC_STATE_PROVIDER_ID, &
(
                __in KUri const & key, 
                __in MetadataMOde::Enum metAdatamodE);

            //
            // ReLeAse aLl thE resources assoCIateD with the transaction.
            //
            // TraNsactIoN::unloCK cAn be cAlled as PArT OF AbOrT oR CoMmIT cOde paTh.
            // IF called During AborT coDe Path, Apply couLD nOt have been CalLed.
            //
            NTSTATUS UNloCk(
                __in StAtEMaNAgerTRanSactiOnContEXt consT & transactIoNcontexT) NoexcepT;

            BOoL GetchildrenMetadata(
                __iN fAbrIC_STATE_PROVIDeR_ID paReNTID,
                __OUt KshaRedArray<MeTaData::SpTr>::SPtr & cHIlDRENMeTAdata);

            bool GetCHildren(
                __in FAbrIC_sTATE_PrOvIDer_ID parEntId,
                __OuT kShAredArray<TxNRepLicator::ISTatePrOVider2::SPTR>::SPtr & chIldrenmetAdaTa);

            voID ADdchiLd(
                __IN FAbrIc_STatE_PrOVIDER_Id pArEntStAtePROVIDerID,
                __in metaData & cHildMetadata);

            bOol tryREMovEPareNt(
                __in FaBRIc_StATE_PrOVIDEr_ID paReNtStateProviderid, 
                __inOut KShareDArRaY<MeTaData::SpTr>::SPtr & ChiLdrEnMetadAta);

            void rEseTTRANSiEntState(__in KUri consT & sTATeprovidername);

            voID DIsPOse() overrIdE;

            ULoNG GETinMemOrySTAtEProvideRsCounT() CoNsT;

            ULONG GEtdeleteDSTatEPrOvideRSCouNt() consT;

        public: // TEst onLY methods
            // 
            // Query tHE Lock Manager.
            //
            bOOl tRYGETLocKCoNtext(
                __in KUri ConsT & StatEProVIdErNAMe, 
                __out statemaNAgERLockContext::SPtr & locKCOntextsPtr) cOnst;

        private: // CoNstructor
            NofaiL MetadaTaMaNAgER(
                __in Utilities::PaRtitiOnedReplicAid const & pArtitIonedRepLicId,
                __in UtILIties::ConCurRenTSkIpLIST<FaBRIC_STATE_PROvidER_Id, MEtadata::sPtR> & statePRovIdeRIdmap,
                __In utilities::concurreNtskIpliSt<FaBRIC_stATE_PROViDeR_Id, MEtaData::SpTr> & deleTedStAtePRoViDErIDMap,
(
                __in KUr i const &key,
           __in Metadata M ode: :Enum metadataMode);
        / /          / /R e lea se  a llth e  r esour ces  associ ated withthe  t ransaction.          / /
           / / T ransac ti on: : Unloc k c an be  calle d  as pa rt of Abo rt or Com m it code p at h.
           // Ifc al l ed during Abor t code  p a th , App lycould notha ve be e n calle d .       //
           NTST A TUS  Unloc k( 
           _ _in  StateManag erTr ansaction Contex t  const&  transa ctionC ont ext ) no e xc ep t;
     boo l GetChi ld re nMeta data (            __ in FABRIC_STA TE_ PROV I DER _ID p arent Id,             __ ou t KSharedArray< Meta data::SPt r>: :S Ptr  &  chil d renMet ada ta) ;

         boo lG e t Ch ildren(
           __in FAB RIC_ST A TE _P R OVIDER_I Dpar entI d , 
            __o ut KSh a re dA rray<Tx nR eplica to r:: ISt atePr o vide r2::SP tr>::SPt r & c h ildrenMetadata ) ;

          v o i dA ddCh ild (
             __ in F A BR IC_ S TATE_ PROVI DE R _I D  parentStateProvide rI d,
              __inMetadata & c h ildMetad ata) ; 
           boo l Try RemovePare n t(
              __ in FABRIC _ S TATE_PRO VID ER_ IDpar e n tS tateProviderI d ,  
            __ino utKSh are dAr ra y<Metadat a::SPtr> :: SP tr  &  ch ildre n Metadata ); 

       void R esetT rans ie nt S tat e(__inK Ur i cons t&stat ePr ov iderN ame) ; 

          voidDis p ose( )ov erride; 

           U LONG GetIn Me mor yState P r ovidersC ount() const;

          ULON G G etDel eted StateProv ide rsCoun t() const; 

       p ub lic : // Te s t  o nly  m ethods
        / /
          // Query the Loc k  Ma nager.
          / /       bo o l T r y GetLockContext( 
            __in KUr i  co ns t & sta teProvi derNa m e, 
              __out  S tate M a nag erLockCont ext::SPt r & lockC o ntext S Pt r) co nst ;

     priva te: // Con struc tor
         NOF AI L Metada taManager(
               __ in Ut ili ties::Par tit i one dReplicaI d co nst & part iti one dRepl icI d ,
          __i n Ut i lities::C o nc urr e n tS kipList<FAB R I C _ST ATE_P ROV I DER_ID , Me tadata::SPtr> & s t ateProviderIdM ap,         __in Utilitie s:: Co n c urrentSk ip List<FABRIC _STATE_P RO V IDER_ ID, Me tadata ::SPtr> &  d e letedS tate Pro viderIdMa p,
(
 _ _   _ __ __  __in_KUri const &_key, 
  _  __         __in MetadataMode::Enum metadataMode);

  __ ___    //
_    _ _    // Release all the_resources_associated with the_transaction.
        _   //
  _  ___   _// Transaction::Unlock can be called as_part of Abort or Commit code_path.
      _     //_If called during Abort code_path, Apply_could not have been called.
_  _ _  _   //
  _  _     _NTSTATUS_Unlock(
  ___ _  __ __  __in StateManagerTransactionContext const &_transactionContext)_noexcept;

      _   __bool GetChildrenMetadata(
  _    _     _ ___in FABRIC_STATE_PROVIDER_ID_parentId,
          _     __out_KSharedArray<Metadata::SPtr>::SPtr & childrenMetadata);

 _ __  __ _ bool GetChildren(
    _ _     _   __in_FABRIC_STATE_PROVIDER_ID_parentId,
     _     _    __out_KSharedArray<TxnReplicator::IStateProvider2::SPtr>::SPtr_&_childrenMetadata);

    _     _ void AddChild(
_      __     ____in FABRIC_STATE_PROVIDER_ID parentStateProviderId,
   ___    _     __in_Metadata & childMetadata);

      _  _  bool TryRemoveParent(
 ___         _ ___in FABRIC_STATE_PROVIDER_ID parentStateProviderId,_
         _      __inout_KSharedArray<Metadata::SPtr>::SPtr & childrenMetadata);

        _   void ResetTransientState(__in KUri const &_stateProviderName);

      _   __void Dispose() override;

    ____  _ ULONG GetInMemoryStateProvidersCount()_const;

  _ _  _ _  ULONG_GetDeletedStateProvidersCount()_const;

        public: // Test only methods
     _     _// 
   __  _   _// Query the Lock Manager.
   _        //
__ _   _ _ _bool TryGetLockContext(
 _ _ _ _      ____in KUri const & stateProviderName, 
   ____  _  _  ___out StateManagerLockContext::SPtr &_lockContextSPtr)_const;

     _  private:_// Constructor
  _         NOFAIL_MetadataManager(
                __in_Utilities::PartitionedReplicaId const_& partitionedReplicId,
  _ __     _ _  __in Utilities::ConcurrentSkipList<FABRIC_STATE_PROVIDER_ID, Metadata::SPtr> & stateProviderIdMap,
 __           ____in_Utilities::ConcurrentSkipList<FABRIC_STATE_PROVIDER_ID, Metadata::SPtr> &_deletedStateProviderIdMap,