PetCenter.Referencias.Inyeccion/Inyeccion/CicloVidaPorPeticion.cs
/// <summary>
/// Obtiene el valor del contexto.
/// </summary>
/// <returns>Contecto actual.</returns>
Obtiene el valor del contexto.
Obtiene el valor del contexto .
public override object GetValue()
        {
            object result = null;
            if (OperationContext.Current != null)
            {
                var containerExtension = OperationContext.Current.Extensions.Find<ContainerExtension>();
                if (containerExtension != null)
                {
                    result = containerExtension.Value;
                }
            }
            else if (HttpContext.Current != null)
            {
                if (HttpContext.Current.Items[_key.ToString()] != null)
                    result = HttpContext.Current.Items[_key.ToString()];
            }
            else
            {
                result = CallContext.GetData(_key.ToString());
            }
            return result;
        }
public override object GetValue ( ) { object result = null ; if ( OperationContext . Current != null ) { var containerExtension = OperationContext . Current . Extensions . Find < ContainerExtension > ( ) ; if ( containerExtension != null ) { result = containerExtension . Value ; } } else if ( HttpContext . Current != null ) { if ( HttpContext . Current . Items [ _key . ToString ( ) ] != null ) result = HttpContext . Current . Items [ _key . ToString ( ) ] ; } else { result = CallContext . GetData ( _key . ToString ( ) ) ; } return result ; }
Obtiene el valor del contexto.
Obtiene el valor del contexto .
//Get object depending on  execution environment ( WCF without HttpContext,HttpContext or CallContext) //WCF without HttpContext environment //HttpContext avaiable ( ASP.NET ..) //Not in WCF or ASP.NET Environment, UnitTesting, WinForms, WPF etc.
None