|
Este artículo proviene de un motor de traducción automática. Mueva el puntero sobre las frases del artículo para ver el texto original. Más información.
|
Traducción
Original
|
PartialCachingAttribute (Clase)
Espacio de nombres: System.Web.UI
Ensamblado: System.Web (en System.Web.dll)
El tipo PartialCachingAttribute expone los siguientes miembros.
| Nombre | Descripción | |
|---|---|---|
![]() | PartialCachingAttribute(Int32) | |
![]() | PartialCachingAttribute(Int32, String, String, String) | |
![]() | PartialCachingAttribute(Int32, String, String, String, Boolean) | |
![]() | PartialCachingAttribute(Int32, String, String, String, String, Boolean) |
| Nombre | Descripción | |
|---|---|---|
![]() | Duration | |
![]() | ProviderName | |
![]() | Shared | |
![]() | SqlDependency | |
![]() | TypeId | |
![]() | VaryByControls | |
![]() | VaryByCustom | |
![]() | VaryByParams |
| Nombre | Descripción | |
|---|---|---|
![]() | Equals | Infraestructura. |
![]() | GetHashCode | |
![]() | GetType | |
![]() | IsDefaultAttribute | |
![]() | Match | |
![]() | ToString |
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | _Attribute.GetIDsOfNames | |
![]() ![]() | _Attribute.GetTypeInfo | |
![]() ![]() | _Attribute.GetTypeInfoCount | Recupera el número de interfaces de tipo de información que suministra un objeto (0 ó 1) |
![]() ![]() | _Attribute.Invoke |
Utilice la directiva @ OutputCache para habilitar el almacenamiento en la caché de resultados en escenarios declarativos. Utilice PartialCachingAttribute para habilitar el almacenamiento en caché de un control de usuario en un archivo de código subyacente. Utilice la clase ControlCachePolicy para especificar los valores de caché mediante programación en escenarios de programación en los que esté trabajando con instancias BasePartialCachingControl.
| Topic | Location |
|---|---|
| Cómo: Almacenar en memoria caché varias versiones de un control de usuario mediante atributos declarativos | Generar aplicaciones Web ASP .NET |
| Cómo: Almacenar en caché múltiples versiones de un control de usuario basado en parámetros | Generar aplicaciones Web ASP .NET |
| Cómo: Almacenar en memoria caché varias versiones de un control de usuario mediante atributos declarativos | Generar aplicaciones Web ASP .NET en Visual Studio |
| Cómo: Almacenar en caché múltiples versiones de un control de usuario basado en parámetros | Generar aplicaciones Web ASP .NET en Visual Studio |
Una clase parcial, ctlMine, que hereda de la clase base UserControl y a la que se aplica el atributo PartialCachingAttribute. Un control de usuario utilizado con la clase parcial ctlMine. Una página de formularios Web Forms que hospeda el control de usuario.
// [filename partialcache.cs] // Create a code-behind user control that is cached // for 20 seconds using the PartialCachingAttribute class. // This control uses a DataGrid server control to display // XML data. using System; using System.IO; using System.Data; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Samples.AspNet.CS.Controls { // Set the PartialCachingAttribute.Duration property to 20 seconds. [PartialCaching(20)] public partial class ctlMine : UserControl { protected void Page_Load(Object Src, EventArgs E) { DataSet ds = new DataSet(); FileStream fs = new FileStream(Server.MapPath("schemadata.xml"), FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(fs); ds.ReadXml(reader); fs.Close(); DataView Source = new DataView(ds.Tables[0]); // Use the LiteralControl constructor to create a new // instance of the class. LiteralControl myLiteral = new LiteralControl(); // Set the LiteralControl.Text property to an HTML // string and the TableName value of a data source. myLiteral.Text = "<h6><font face=verdana>Caching an XML Table: " + Source.Table.TableName + " </font></h6>"; MyDataGrid.DataSource = Source; MyDataGrid.DataBind(); TimeMsg.Text = DateTime.Now.ToString("G"); } } }
<!-- The mark-up .ascx file that displays the output of
the partialcache.cs user control code-behind file. -->
<%@ Control language="C#" inherits="Samples.AspNet.CS.Controls.ctlMine" CodeFile="partialcache.cs.ascx.cs" %>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="900"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding="3"
CellSpacing="0"
Font-Names="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false"
/>
<br />
<i>Control last generated on:</i> <asp:label id="TimeMsg" runat="server" />
<!-- The WebForms page that contains the user control generated
by partialcache.cs. -->
<%@ Register TagPrefix="Acme" TagName="Cache" Src="partialcache.cs.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script language="C#" runat="server">
void Page_Load(Object Src, EventArgs E ) {
TimeMsg.Text = DateTime.Now.ToString("G");
}
</script>
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<Acme:Cache runat="server"/>
<br />
<i>Page last generated on:</i> <asp:label id="TimeMsg" runat="server" />
</form>
</body>
</html>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (no se admite el rol Server Core), Windows Server 2008 R2 (se admite el rol Server Core con SP1 o versiones posteriores; no se admite Itanium)
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
