Files
Marek Habersack 4a7be3c007 2009-09-18 Marek Habersack <[email protected]>
* MetaTable.cs: implemented Init - calls Init on all the columns
	present in this instance.

	* MetaModel.cs: constructor initializes FieldTemplateFactory after
	it is instantiated.
	RegisterContextCore first registers the context type, then creates
	tables and finally calls Init on all the tables.

	* MetaColumn.cs: added internal Init method - called by MetaModel
	after context is registered and all tables are created and
	registered.

	* MetaChildrenColumn.cs: implemented ChildTable,
	ColumnInOtherTable, GetChildrenListPath, GetChildrenPath and added
	an internal Init method override. MonoTODO attributes stay until I
	write tests for the class.

	* FieldTemplateUserControl.cs: implemented ChildrenColumn,
	ChildrenPath, Column, ForeignKeyColumn, ForeignKeyPath,
	MetadataAttributes, Mode, Row, Table, SetHost

	* FieldTemplateFactory.cs: GetFieldTemplateVirtualPath fixes

	* DynamicControl.cs: implemented ApplyFormatInEditMode,
	ConvertEmptyStringToNull, DataField, DataFormatString, HtmlEncode,
	FormattingOptions, NullDisplayText, UIHint, OnInit, Render.

2009-09-18  Marek Habersack  <[email protected]>

	* TestsBasePage.cs: added an event ItemDataBinding, invoked
	whenever an item is data bound.

2009-09-18  Marek Habersack  <[email protected]>

	* Makefile (TEST_RESOURCE_FILES): added
	Test/WebPages/ListView_DynamicControl_10.aspx,
	Test/WebPages/ListView_DynamicControl_10.aspx.cs

2009-09-18  Marek Habersack  <[email protected]>

	* DynamicControlTest.cs: FieldTemplate_1 - fixed fake edit
	postback for Mono.

svn path=/trunk/mcs/; revision=142161
2009-09-18 00:24:11 +00:00

104 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Configuration;
using System.Web.DynamicData;
using System.Web.UI;
using MonoTests.SystemWeb.Framework;
using MonoTests.DataSource;
namespace MonoTests.Common
{
public class TestsBasePage<DataContextType> : global::System.Web.UI.Page where DataContextType : new ()
{
Type containerType;
bool? outsideTestSuite;
public event EventHandler ItemDataBinding;
public bool OutsideTestSuite
{
get
{
if (outsideTestSuite == null) {
object o = WebConfigurationManager.AppSettings["OutsideTestSuite"];
string s = o as string;
bool b;
if (s == null)
outsideTestSuite = false;
else if (Boolean.TryParse (s, out b))
outsideTestSuite = b;
else
outsideTestSuite = false;
}
return (bool)outsideTestSuite;
}
set
{
outsideTestSuite = value;
}
}
public virtual Type ContextType
{
get { return typeof (DataContextType); }
}
public virtual Type ContainerType
{
get
{
if (containerType == null) {
Type genType = typeof (TestDataContainer<>).GetGenericTypeDefinition ();
containerType = genType.MakeGenericType (new Type[] { ContextType });
}
return containerType;
}
}
public virtual string ContainerTypeName
{
get { return ContainerType.AssemblyQualifiedName; }
}
protected virtual IDynamicDataContainer<DataContextType> CreateContainerInstance ()
{
return Activator.CreateInstance (ContainerType) as IDynamicDataContainer<DataContextType>;
}
protected virtual void InitializeDataSource (DynamicDataSource ds, string tableName)
{
ds.DataContainerTypeName = ContainerTypeName;
ds.EntitySetName = tableName;
ds.ContextType = typeof (DataContextType);
ds.DataContainerInstance = CreateContainerInstance ();
PopulateDataSource (ds);
}
protected virtual void PopulateDataSource (DynamicDataSource ds)
{
}
protected override void OnPreInit (EventArgs e)
{
if (!OutsideTestSuite) {
WebTest t = WebTest.CurrentTest;
if (t != null)
t.Invoke (this);
}
}
public void Item_DataBinding (object sender, EventArgs args)
{
EventHandler eh = ItemDataBinding;
if (eh != null)
eh (sender, args);
}
}
}