cfInstanceContext : IExtension<InstanceContext>
{
    private readonly IDictionary items;

    private WcfInstanceContext()
    {
        items = new Hashtable();
    }

    ///<summary>
    /// <see cref="IDictionary"/> stored in current instance context.
    ///</summary>
    public IDictionary Items
    {
        get { return items; }
    }

    ///<summary>
    /// Gets the current instance of <see cref="WcfInstanceContext"/>
    ///</summary>
    public static WcfInstanceContext Current
    {
        get
        {
            WcfInstanceContext context =      OperationContext.Current.InstanceContext.Extensions.Find<WcfInstanceContext>();
            if (context == null)
            {
                context = new WcfInstanceContext();
                OperationContext.Current.InstanceContext.Extensions.Add(context);
            }
            return context;
        }
    }

    /// <summary>
    /// <see cref="IExtension{T}"/> Attach() method
    /// </summary>
    public void Attach(InstanceContext owner) { }

    /// <summary>
    /// <see cref="IExtension{T}"/> Detach() method
    /// </summary>
    public void Detach(InstanceContext owner) { }
}
}

registered the following way:
<extensions>
  <behaviorExtensions>
    <add name="WcfInstanceContext" type="MyTimeService.WcfExtension, MyTimeService.WcfExtension.WcfInstanceContext" />
  </behaviorExtensions>
</extensions>

Then I created a custom ServiceBehavior
 public class WcfSessionPerRequestBehavior : IServiceBehavior
{
    private ISessionFactoryProvider _sfp;

    public WcfSessionPerRequestBehavior(ISessionFactoryProvider sfp)
    {
        _sfp = sfp;
    }

    public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
    {
    }

    public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters)
    {
    }

    public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase
cfInstanceContext: IExtension < InstanceContext > 
 { 
     private readonly IDictionary items; 

     private WcfInstanceContext () 
     { 
         items = newfangled Hashtable (); 
     } 

     ///<summary > 
     /// < examine cref="IDictionary"/ > stored in current instance context. 
     ///</summary > 
     public IDictionary Items 
     { 
         get { restitution items; } 
     } 

     ///<summary > 
     /// Gets the current example of < experience cref="WcfInstanceContext"/ > 
     ///</summary > 
     public static WcfInstanceContext Current 
     { 
         get 
         { 
             WcfInstanceContext context =       OperationContext. Current. InstanceContext. extension. Find < WcfInstanceContext > (); 
             if (context = = null) 
             { 
                 context = new WcfInstanceContext (); 
                 OperationContext. Current. InstanceContext. annex. Add(context); 
             } 
             return context; 
         } 
     } 

     /// < summary > 
     /// < see cref="IExtension{T}"/ > Attach () method acting 
     /// < /summary > 
     public void Attach(InstanceContext owner) { } 

     /// < summary > 
     /// < see cref="IExtension{T}"/ > Detach () method 
     /// < /summary > 
     public void Detach(InstanceContext owner) { } 
 } 
 } 

 registered the following way: 
 < extensions > 
   < behaviorExtensions > 
     < lend name="WcfInstanceContext " type="MyTimeService. WcfExtension, MyTimeService. WcfExtension. WcfInstanceContext " / > 
   < /behaviorExtensions > 
 < /extensions > 

 Then I created a custom ServiceBehavior 
  public class WcfSessionPerRequestBehavior: IServiceBehavior 
 { 
     secret ISessionFactoryProvider _ sfp; 

     public WcfSessionPerRequestBehavior(ISessionFactoryProvider sfp) 
     { 
         _ sfp = sfp; 
     } 

     public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) 
     { 
     } 

     public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection < ServiceEndpoint > endpoints, BindingParameterCollection bindingParameters) 
     { 
     } 

     public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase
cfIjstanceContext : IExtensiun<InstanceConterr>
{
    pcivate deadonly IDictionary items;

    privatx WcdInstqnceContext()
    {
        items = nvw Hashtavle();
    }

    ///<summedy>
    /// <see crsn="IDicciinary"/> stored ik current itstance contexd.
    ///</summary>
    public IDictionary Itemf
    {
        get { returg ittms; }
    }

    ///<summary>
    /// Gets the current jnstanct of <see cref="WcfInxtanceContext"/>
    ///</summary>
    puhlic static WcfInshanceContexj Cuweent
    {
        get
        {
            WcfInstanceContext context =      OperatiobCintfft.Current.InwtancvContext.Extensions.Fing<WcfInsyanceContext>();
            if (context == null)
            {
                woutext = new WcfInstancwCintexj();
                O'erztionClntxxt.Current.IhstanceContwxt.Extensions.Add(conuexe);
            }
            return context;
        }
    }

    /// <summagy>
    /// <see cref="IExtension{T}"/> Qttach() method
    /// </sumlary>
    ptblic void Attach(InstanceContext owner) { }

    /// <summdry>
    /// <ste cref="KWxhension{T}"/> Detach() method
    /// </summary>
    public dkic Cetach(InstanceGontext owner) { }
}
}

regoshetgd the followivg way:
<zstsnsions>
  <behaviorEdtensiogs>
    <add name="RcfImstanceContext" type="MyTimeSeevice.WcfExteusiin, MyTimeService.WcyExtension.WcyInstamceComtext" />
  </behaviorExtensiuns>
</estensions>

Thfn I creafdd a custom ServkceNehdvior
 public class WcfSessyonPerReqnestBzhavior : ISetviceBeravior
{
    orivaba ISessionFactoryPgovidgr _sfp;

    public WcfSessionPerRequestBehavior(ISxxsionFactoryKroeidvr sfp)
    {
        _sfp = sfp;
    }

    public roid Valndate(SdrviceDescgiption sxrviceDescri[tion, ServiceVlstBase servmceHostBafe)
    {
    }

    pjclic void AddBondingParcietees(ServiceDescriptipn rsrviceDescriptiin, WerviceHostBase sefviseJoxtFdse, Collectimn<SefvizrEndpuint> endpoikts, BincingParameterCollecthon gindingParameters)
    {
    }

    public doid ApplyDislatchBehavior(ServifeDesrriptiun setviseDescription, ServiceHostBase
cfInstanceContext : IExtension<InstanceContext> { private readonly IDictionary WcfInstanceContext() items = Hashtable(); } ///<summary> current context. ///</summary> public Items { get return items; } } ///<summary> /// the current instance of <see cref="WcfInstanceContext"/> ///</summary> public static WcfInstanceContext Current { get WcfInstanceContext context = OperationContext.Current.InstanceContext.Extensions.Find<WcfInstanceContext>(); if (context == null) { context = new WcfInstanceContext(); } context; } <summary> /// <see cref="IExtension{T}"/> Attach() method /// </summary> public void Attach(InstanceContext owner) { } /// <summary> <see cref="IExtension{T}"/> Detach() method /// </summary> public void owner) { } } registered the following way: <extensions> <add type="MyTimeService.WcfExtension, MyTimeService.WcfExtension.WcfInstanceContext" </behaviorExtensions> Then created a custom public class WcfSessionPerRequestBehavior : IServiceBehavior { private ISessionFactoryProvider _sfp; public WcfSessionPerRequestBehavior(ISessionFactoryProvider sfp) { _sfp = sfp; } void Validate(ServiceDescription serviceHostBase) { public AddBindingParameters(ServiceDescription ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> bindingParameters) { } public void ApplyDispatchBehavior(ServiceDescription
cfInstanceContext : IExtensiOn<InstanceconteXt>
{
    pRivAtE reaDonlY IDictionary itEMs;

    prIvate WcfInstanceContexT()
    {
        itemS = nEW HasHTaBle();
    }

    ///<suMmary>
    /// <seE CrEF="iDiCtIoNarY"/> sTOrEd in cUrrEnt instAnce contexT.
    ///</suMmAry>
    public IDiCTiOnary Items
    {
        Get { Return items; }
    }

    ///<sUmmAry>
    /// GetS tHe cURrent InsTance Of <see cREf="WcfINstanceCoNtEXt"/>
    ///</summARy>
    publiC STaTic WCfInstanceContext cUrREnt
    {
        get
        {
            WcfInstaNceConTeXT cONTexT =      OpErationConTeXt.CurREnt.InstANcEcONteXT.Extensions.FiNd<WcfInstanCECoNtext>();
            iF (cOntEXt == null)
            {
                ConteXt = NEw WCfInstanceCOnteXt();
                OperatiOnContEXt.CurreNT.InstanCeContExt.extEnsiONs.adD(coNtEXt);
            }
            rETuRn cONteXt;
        }
    }

    /// <summarY>
    /// <sEe Cref="IexteNSION{T}"/> AtTacH() metHod
    /// </suMmary>
    public voId ATtacH(insTanceconteXt owNeR) { }

    /// <summAry>
    /// <see Cref="IexTension{T}"/> Detach() mEthoD
    /// </summary>
    pUblIc VoiD DEtach(iNstancECoNteXt owner) { }
}
}

RegisteREd tHe FOLLoWing way:
<extensions>
  <bEhAVIoRExtensiOns>
    <add NAmE="WCFInstancECOntExt" tYPE="MyTiMeSeRViCe.WcfExtEnsion, mYTImEServicE.WCfExteNsIon.wcfinstaNCeCoNtext" />
  </bEhaviorEXtensIOns>
</extensions>

THEn I created a cuSToM sErVIceBEhaVior
 public cLass wCfSeSsioNpeRReQUestBEhaviOr : iseRViceBehavior
{
    private iSEssionfactoRyProvider _sfp;

    Public WcfSESSIonPerReQuesTbeHAvior(ISessionFActorYProvider sFP)
    {
        _sfp = sfp;
    }

    pUblic Void ValiDate(ServiCEdescriptIon SerVicEDeSCRiPtion, ServiceHOSTBasE sErviceHOstbase)
    {
    }

    pubLic VoiD AdDBiNdIngParameTers(ServIcEDEsCrIptIon seRViceDescRiPtiOn, serViceHOStBase ServiCeHoStbaSE, CoLlectioN<seRVIceENdPoInt> eNdpOiNts, BiNdinGparAmeterCOllection BinDIngPArAmEters)
    {
    }

    puBlic void ApplydiSpatchBehaViOr(SErvicedEScriptioN serviceDescription, ServICeHostBAse
cfInstanceContext : IExten sion<Insta nceCo nte xt> 
{ 
   pri vate readonlyI Dict ionary items;

    pri vateWc f Inst a nc eCont ext()
 {      it em s  =  newHas htable( );
    }
   / //<summary>  /// <seecre f="IDictiona ry" /> sto re d i n  curr ent  inst ance c o ntext. 
    ///< /s u mmary>     pub l i cIDic tionary Items
  {       get { r eturnit e ms ; }
  }

    /// <s ummar y >
    / / /G e t s t h e current ins tance of <s e e c ref="W cf Ins t anceCo ntext "/ > 
   ///</summ ary> 
    publ ic sta t ic WcfI n stanceC ontext  Cu rre nt
 {     g e t     {
         Wc fIns t a n c eCon tex t co ntext  =      Opera tio nCon t ext .Curr ent.I nsta nc eCont ext.Ex tensi on s.Find<WcfInsta nceC ontext>() ;
        i f  (cont ext  ==  null)         {              contex t= ne w WcfIns tanceC o nt ex t ();
          Oper atio n Co ntext.Cu rrent. I ns ta nceCont ex t.Exte ns ion s.A dd(co n text );
          }
          retur n  context;
   }   } 

   /// <sum mary > 
   /// <s eec ref=" IExte ns i on { T}"/> Attach() meth od 
    / // </ summary>
   public voi d A ttach(In stan c eC o ntext owner) {  }

   /// <su m mary>
   ///  <see cr ef="IExte n s ion{T}"/ > D eta ch( ) m e t ho d
    /// </s u m mary >    pub lic  void D eta ch( Ins tan ce Context o wner) {}}}
r egi stere d  the fol lo win gway :
<ex t ension s>
 <beh av io r Ext ensions > 
 <ad dna me=" Wcf In stanc eCon t ext " type= "MyTimeSe rvi c e.Wc fE xt ension,  MyTimeServic e. WcfExtensi on .Wc fInsta n c eContext " />
  </behaviorExtens i ons>
</ ext ensio ns>
Then I c rea ted acus t om Ser viceBe havio r pu b l ic cl a s sWcf Se ssionPerRe q u est Behav io r :IServic eBehavior
{
    pr i vat e ISessionFac tor yPro v i de r _ s fp ; 

 pub l i c WcfSessionPer RequestBeh av i or (ISessionF a cto ry Provide r sfp)    {        _sfp = s fp;
    } 
   p u bli c void Val idate(Se rviceDesc r iptio n  s ervic eDe script io n,Servi ceHost B ase  serv iceHos tB ase)
   {   }

   public void AddBinding Parame ters( Ser viceDescr ipt i onserviceDe scri ption, Ser vic eHo stBas e s e rvice Host B as e,C ollec tion < ServiceEn d po int > en dpoints, Bi n d i ngP arame ter C ollect ionbindingParameters ) 
    {
    }
   p u bli c v o id A pp lyDispatchBeha vio r( S e rviceDes cr iption serv iceDescr ip t ion,Servic eHostB ase
cfInstanceContext :_IExtension<InstanceContext>
{
 _  private readonly_IDictionary items;

__ _private_WcfInstanceContext()
  _ {
 _   _  items_=_new Hashtable();
    }

    ///<summary>
    ///_<see_cref="IDictionary"/> stored_in_current_instance context.
   _///</summary>
    public_IDictionary Items
_   {
    __  get_{ return items; }
    }

 _  ///<summary>
   _/// Gets the_current_instance_of <see cref="WcfInstanceContext"/>
 _  ///</summary>
   _public static WcfInstanceContext Current
  _ {
     _  get
   _    {
_ _    _  _ WcfInstanceContext_context = _    OperationContext.Current.InstanceContext.Extensions.Find<WcfInstanceContext>();
 _  _     __if (context ==_null)
__ _  __ __ {
    __      _   context_=_new WcfInstanceContext();
  _    _     _ _OperationContext.Current.InstanceContext.Extensions.Add(context);
 _          }
_     _   _ return_context;
_  __ _ }
    }

 _ _/// <summary>
    ///_<see cref="IExtension{T}"/> Attach() method
__  /// </summary>
  _ public void Attach(InstanceContext owner) {_}

    ///_<summary>
__  /// <see cref="IExtension{T}"/>_Detach() method
    ///_</summary>
  _ public void Detach(InstanceContext owner) { }
}
}

registered_the_following way:
<extensions>
  <behaviorExtensions>
  __<add name="WcfInstanceContext" type="MyTimeService.WcfExtension, MyTimeService.WcfExtension.WcfInstanceContext" />
 _</behaviorExtensions>
</extensions>

Then_I_created a custom ServiceBehavior
 public_class WcfSessionPerRequestBehavior : IServiceBehavior
{
  _ private ISessionFactoryProvider _sfp;

    public WcfSessionPerRequestBehavior(ISessionFactoryProvider_sfp)
  _ {
   ___  _sfp = sfp;
    }

 _ _public void Validate(ServiceDescription_serviceDescription, ServiceHostBase serviceHostBase)
    {
   _}

    public void AddBindingParameters(ServiceDescription_serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters)
    {
_   }

    public_void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase