Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Caching;
namespace Test
{
public class InMemoryProvider : OutputCacheProvider
{
Dictionary<string, object> cache = new Dictionary<string, object> ();
public override object Add (string key, object entry, DateTime utcExpiry)
{
object value;
if (cache.TryGetValue (key, out value))
return value;
cache.Add (key, entry);
return entry;
}
public override object Get (string key)
{
object ret;
if (cache.TryGetValue (key, out ret))
return ret;
return null;
}
public override void Remove (string key)
{
if (cache.ContainsKey (key))
cache.Remove (key);
}
public override void Set (string key, object entry, DateTime utcExpiry)
{
if (cache.ContainsKey (key))
cache[key] = entry;
else
cache.Add (key, entry);
}
}
}

View File

@ -0,0 +1,14 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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">
<head runat="server">
<title>OutputCacheProvider Test 1</title>
</head>
<body>
<form id="form1" runat="server">
<div><%= AppDomain.CurrentDomain.GetData ("BEGIN_CODE_MARKER") %><pre runat="server" id="output"></pre><%= AppDomain.CurrentDomain.GetData ("END_CODE_MARKER") %></div>
</form>
</body>
</html>

View File

@ -0,0 +1,24 @@
using System;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
var sb = new StringBuilder ();
string name = OutputCache.DefaultProviderName;
sb.AppendFormat ("Default provider name: {0}\n", name);
name = ApplicationInstance.GetOutputCacheProviderName (null);
sb.AppendFormat ("Null context: {0}\n", name);
name = ApplicationInstance.GetOutputCacheProviderName (Context);
sb.AppendFormat ("Default context: {0}\n", name);
output.InnerText = sb.ToString ();
}
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<caching>
<outputCache defaultProvider="TestInMemoryProvider">
<providers>
<add name="TestInMemoryProvider" type="Test.InMemoryProvider, App_Code"/>
</providers>
</outputCache>
</caching>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

View File

@ -0,0 +1,14 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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">
<head runat="server">
<title>OutputCacheProvider Test 1</title>
</head>
<body>
<form id="form1" runat="server">
<div><pre runat="server" id="output"></pre></div>
</form>
</body>
</html>

View File

@ -0,0 +1,24 @@
using System;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
var sb = new StringBuilder ();
string name = OutputCache.DefaultProviderName;
sb.AppendFormat ("Default provider name: {0}\n", name);
name = ApplicationInstance.GetOutputCacheProviderName (null);
sb.AppendFormat ("Null context: {0}\n", name);
name = ApplicationInstance.GetOutputCacheProviderName (Context);
sb.AppendFormat ("Default context: {0}\n", name);
output.InnerText = sb.ToString ();
}
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<caching>
<outputCache defaultProvider="MissingInMemoryProvider">
<providers>
<add name="MissingInMemoryProvider" type="Test.InMemoryProvider"/>
</providers>
</outputCache>
</caching>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Caching;
namespace Test
{
public class AnotherInMemoryProvider : InMemoryProvider
{
}
}

View File

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Caching;
namespace Test
{
public class InMemoryProvider : OutputCacheProvider
{
Dictionary<string, object> cache = new Dictionary<string, object> ();
public override object Add (string key, object entry, DateTime utcExpiry)
{
object value;
if (cache.TryGetValue (key, out value))
return value;
cache.Add (key, entry);
return entry;
}
public override object Get (string key)
{
object ret;
if (cache.TryGetValue (key, out ret))
return ret;
return null;
}
public override void Remove (string key)
{
if (cache.ContainsKey (key))
cache.Remove (key);
}
public override void Set (string key, object entry, DateTime utcExpiry)
{
if (cache.ContainsKey (key))
cache[key] = entry;
else
cache.Add (key, entry);
}
}
}

View File

@ -0,0 +1,14 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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">
<head runat="server">
<title>OutputCacheProvider Test 1</title>
</head>
<body>
<form id="form1" runat="server">
<div><%= AppDomain.CurrentDomain.GetData ("BEGIN_CODE_MARKER") %><pre runat="server" id="output"></pre><%= AppDomain.CurrentDomain.GetData ("END_CODE_MARKER") %></div>
</form>
</body>
</html>

View File

@ -0,0 +1,21 @@
using System;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
var sb = new StringBuilder ();
string name = OutputCache.DefaultProviderName;
sb.AppendFormat ("Default provider name: {0}\n", name);
name = ApplicationInstance.GetOutputCacheProviderName (Context);
sb.AppendFormat ("Default context: {0}\n", name);
output.InnerText = sb.ToString ();
}
}

View File

@ -0,0 +1,26 @@
<%@ Application Language="C#" %>
<script RunAt="server">
public override string GetOutputCacheProviderName (HttpContext context)
{
if (context == null)
throw new ArgumentNullException ("context");
HttpRequest req = context.Request;
if (req == null)
throw new InvalidOperationException ("No request found.");
switch (req.QueryString["ocp"]) {
case "InMemory":
return "TestInMemoryProvider";
case "AnotherInMemory":
return "TestAnotherInMemoryProvider";
case "invalid":
return "NoSuchProviderFound";
default:
return base.GetOutputCacheProviderName (context);
}
}
</script>

View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<caching>
<outputCache>
<providers>
<add name="TestInMemoryProvider" type="Test.InMemoryProvider, App_Code"/>
<add name="TestAnotherInMemoryProvider" type="Test.AnotherInMemoryProvider, App_Code"/>
</providers>
</outputCache>
</caching>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>