mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
* MetaModel.cs: implemented DynamicDataFolderVirtualPath
* DynamicDataRouteHandler.cs: implemented SetRequestMetaTable,
GetCustomPageVirtualPath, GetScaffoldPageVirtualPath and
guessed at implementation of CreateHandler.
2009-06-27 Marek Habersack <[email protected]>
* MetaModelTest.cs: added test for DynamicDataFolderVirtualPath
* DynamicDataRouteHandlerTest.cs: implemented tests for
CreateHandler (one of them isn't working atm),
GetCustomVirtualPagePath, GetScaffoldVirtualPagePath,
GetRequestMetaTable, SetRequestMetaTable
2009-06-26 Marek Habersack <[email protected]>
* DynamicDataRouteTest.cs: MyDataContext3 is safely registered in
the fixture setup method.
Enabled the GetTableFromRouteData3 and GetRouteData tests - the
work fine now.
Added test for the RouteHandler property.
* DynamicDataRouteHandlerTest.cs: added tests for the constructor
and the Model property.
2009-06-26 Marek Habersack <[email protected]>
* MetaModel.cs: RegisterContextCore preserves already registered
tables.
* DynamicDataRouteHandler.cs: GetRequestContext must not retrieve
route data from the routes collection (if the matching route
happened to be an instance of DynamicDataRoute it would initialize
its RouteHandler's Model property, which is not correct, according
to tests). Instead a new RouteData instance is created each time
we don't find any cached context.
* DynamicDataRoute.cs: the associated route handler is set its
Model property when we initialize for the first time.
GetRouteData checks whether route data returned by base class
relates to a table which exists in the current context. If no such
table exists, null is returned.
svn path=/trunk/mcs/; revision=137013
84 lines
1.7 KiB
C#
84 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Specialized;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Web;
|
|
|
|
namespace MonoTests.Common
|
|
{
|
|
class MyHttpRequestWrapper : HttpRequestBase
|
|
{
|
|
Dictionary<string, object> propertyValues = new Dictionary<string, object> ();
|
|
|
|
public override string AppRelativeCurrentExecutionFilePath
|
|
{
|
|
get
|
|
{
|
|
string value;
|
|
if (!GetProperty<string> ("AppRelativeCurrentExecutionFilePath", out value))
|
|
return base.AppRelativeCurrentExecutionFilePath;
|
|
|
|
return value;
|
|
}
|
|
}
|
|
|
|
public override string PathInfo
|
|
{
|
|
get
|
|
{
|
|
string value;
|
|
if (!GetProperty<string> ("PathInfo", out value))
|
|
return base.PathInfo;
|
|
|
|
return value;
|
|
}
|
|
}
|
|
|
|
public override NameValueCollection QueryString
|
|
{
|
|
get
|
|
{
|
|
NameValueCollection value;
|
|
if (!GetProperty<NameValueCollection> ("QueryString", out value))
|
|
return base.QueryString;
|
|
|
|
return value;
|
|
}
|
|
}
|
|
|
|
bool GetProperty<T> (string name, out T value)
|
|
{
|
|
if (String.IsNullOrEmpty (name))
|
|
throw new ArgumentNullException ("name");
|
|
|
|
value = default (T);
|
|
object v;
|
|
if (propertyValues.TryGetValue (name, out v)) {
|
|
if (v == null)
|
|
return true;
|
|
if (typeof (T).IsAssignableFrom (v.GetType ())) {
|
|
value = (T) v;
|
|
return true;
|
|
}
|
|
|
|
throw new InvalidOperationException ("Invalid value type. Expected '" + typeof (T) + "' and got '" + v.GetType () + "'");
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public void SetProperty (string name, object value)
|
|
{
|
|
if (String.IsNullOrEmpty (name))
|
|
return;
|
|
|
|
if (propertyValues.ContainsKey (name))
|
|
propertyValues[name] = value;
|
|
else
|
|
propertyValues.Add (name, value);
|
|
}
|
|
}
|
|
}
|