Author: mhabersack
Date: 2007-05-15 05:35:00 -0400 (Tue, 15 May 2007)
New Revision: 77396
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/BuildProviderCollection.cs
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/HttpHandlerAction.cs
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
trunk/mcs/class/System.Web/System.Web/ChangeLog
trunk/mcs/class/System.Web/System.Web/HttpApplication.cs
Log:
2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
* TemplateParser.cs: refactoring - use HttpApplication.LoadType to
actually look up types.
* ControlBuilder.cs: as above
2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
* BuildProviderCollection.cs: refactoring - use
HttpApplication.LoadType to actually look up the type.
* HttpHandlerAction.cs: as above
* WebConfigurationHost.cs: refactoring - moved the LoadType to
HttpApplication to share the code between 1.1 and 2.0 profiles.
2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
* ObjectDataSourceView.cs: refactoring - use
HttpApplication.LoadType to look up types.
2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
* HttpApplication.cs: refactoring - moved LoadType from
WebConfigurationHost here and made it internal static, in order to
make the code avaliable from all the places where extended type
loading is required.
Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-05-15 08:59:42 UTC
(rev 77395)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-05-15 09:35:00 UTC
(rev 77396)
@@ -1,3 +1,10 @@
+2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
+
+ * HttpApplication.cs: refactoring - moved LoadType from
+ WebConfigurationHost here and made it internal static, in order to
+ make the code avaliable from all the places where extended type
+ loading is required.
+
2007-05-14 Marek Habersack <[EMAIL PROTECTED]>
* HttpUtility.cs: when parsing query strings, skip the leading ?
Modified: trunk/mcs/class/System.Web/System.Web/HttpApplication.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpApplication.cs 2007-05-15
08:59:42 UTC (rev 77395)
+++ trunk/mcs/class/System.Web/System.Web/HttpApplication.cs 2007-05-15
09:35:00 UTC (rev 77396)
@@ -67,6 +67,7 @@
using System.ComponentModel;
using System.Configuration;
using System.Globalization;
+using System.Reflection;
using System.Security.Permissions;
using System.Security.Principal;
using System.Threading;
@@ -1304,6 +1305,63 @@
}
}
#endregion
+
+ private static string privateBinPath;
+ private static string PrivateBinPath {
+ get {
+ if (privateBinPath != null)
+ return privateBinPath;
+
+ AppDomainSetup setup =
AppDomain.CurrentDomain.SetupInformation;
+ privateBinPath =
Path.Combine(setup.ApplicationBase, setup.PrivateBinPath);
+ return privateBinPath;
+ }
+ }
+
+ internal static Type LoadType (string typeName)
+ {
+ return LoadType (typeName, false);
+ }
+
+ internal static Type LoadType (string typeName, bool
throwOnMissing)
+ {
+ Type type = Type.GetType (typeName, throwOnMissing);
+ if (type != null)
+ return type;
+
+#if NET_2_0
+ IList tla =
System.Web.Compilation.BuildManager.TopLevelAssemblies;
+ if (tla != null && tla.Count > 0) {
+ foreach (Assembly asm in tla) {
+ if (asm == null)
+ continue;
+ type = asm.GetType (typeName,
throwOnMissing);
+ if (type != null)
+ break;
+ }
+ }
+ if (type != null)
+ return type;
+#endif
+
+ if (!Directory.Exists (PrivateBinPath))
+ return null;
+
+ string[] binDlls = Directory.GetFiles(PrivateBinPath,
"*.dll");
+ foreach (string s in binDlls) {
+ Assembly binA = Assembly.LoadFrom (s);
+ type = binA.GetType (typeName, throwOnMissing);
+ if (type == null)
+ continue;
+
+ return type;
+ }
+
+ if (throwOnMissing)
+ throw new TypeLoadException (String.Format
("Type '{0}' cannot be found", typeName));
+
+ return null;
+ }
}
//
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
2007-05-15 08:59:42 UTC (rev 77395)
+++
trunk/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryConfiguration.cs
2007-05-15 09:35:00 UTC (rev 77396)
@@ -107,7 +107,7 @@
Type t;
try {
- t = Type.GetType (type_name, true);
+ t = HttpApplication.LoadType (type_name, true);
} catch {
throw new HttpException (String.Format ("Failed
to load httpHandler type `{0}'", type_name));
}
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/BuildProviderCollection.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/BuildProviderCollection.cs
2007-05-15 08:59:42 UTC (rev 77395)
+++
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/BuildProviderCollection.cs
2007-05-15 09:35:00 UTC (rev 77396)
@@ -98,8 +98,11 @@
foreach (BuildProvider provider in this) {
if (extension != provider.Extension)
continue;
-
- Type type = Type.GetType (provider.Type);
+
+ Type type = HttpApplication.LoadType
(provider.Type);
+ if (type == null)
+ return null;
+
return (System.Web.Compilation.BuildProvider)
Activator.CreateInstance (type, null);
}
Modified: trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
2007-05-15 08:59:42 UTC (rev 77395)
+++ trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
2007-05-15 09:35:00 UTC (rev 77396)
@@ -1,3 +1,13 @@
+2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
+
+ * BuildProviderCollection.cs: refactoring - use
+ HttpApplication.LoadType to actually look up the type.
+
+ * HttpHandlerAction.cs: as above
+
+ * WebConfigurationHost.cs: refactoring - moved the LoadType to
+ HttpApplication to share the code between 1.1 and 2.0 profiles.
+
2007-05-14 Marek Habersack <[EMAIL PROTECTED]>
* UrlMappingCollection.cs: implemented the Item (string) indexer.
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/HttpHandlerAction.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/HttpHandlerAction.cs
2007-05-15 08:59:42 UTC (rev 77395)
+++
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/HttpHandlerAction.cs
2007-05-15 09:35:00 UTC (rev 77396)
@@ -179,19 +179,7 @@
{
Type t = null;
- t = System.Type.GetType (type_name, false);
- if (t == null) {
- IList tla =
System.Web.Compilation.BuildManager.TopLevelAssemblies;
- if (tla != null && tla.Count > 0) {
- foreach (Assembly asm in tla) {
- if (asm == null)
- continue;
- t = asm.GetType (type_name,
false);
- if (t != null)
- break;
- }
- }
- }
+ t = HttpApplication.LoadType (type_name, false);
if (t == null)
throw new HttpException (String.Format ("Failed
to load httpHandler type `{0}'", type_name));
Modified:
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs
2007-05-15 08:59:42 UTC (rev 77395)
+++
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs
2007-05-15 09:35:00 UTC (rev 77396)
@@ -90,58 +90,10 @@
{
return configPath + "/" + locatinSubPath;
}
-
- private static string privateBinPath;
-
- private static string PrivateBinPath {
- get {
- if (privateBinPath != null)
- return privateBinPath;
-
- AppDomainSetup setup =
AppDomain.CurrentDomain.SetupInformation;
- privateBinPath =
Path.Combine(setup.ApplicationBase, setup.PrivateBinPath);
- return privateBinPath;
- }
- }
- private Type LoadType(string typeName)
- {
- Type type = Type.GetType (typeName);
- if (type != null)
- return type;
-
- IList tla =
System.Web.Compilation.BuildManager.TopLevelAssemblies;
- if (tla != null && tla.Count > 0) {
- foreach (Assembly asm in tla) {
- if (asm == null)
- continue;
- type = asm.GetType (typeName, false);
- if (type != null)
- break;
- }
- }
- if (type != null)
- return type;
-
- if (!Directory.Exists (PrivateBinPath))
- return null;
-
- string[] binDlls = Directory.GetFiles(PrivateBinPath,
"*.dll");
- foreach (string s in binDlls) {
- Assembly binA = Assembly.LoadFrom (s);
- type = binA.GetType (typeName);
- if (type == null)
- continue;
-
- return type;
- }
-
- return null;
- }
-
public virtual Type GetConfigType (string typeName, bool
throwOnError)
{
- Type type = LoadType(typeName);
+ Type type = HttpApplication.LoadType (typeName);
if (type == null && throwOnError)
throw new ConfigurationErrorsException ("Type
not found: '" + typeName + "'");
return type;
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-05-15 08:59:42 UTC
(rev 77395)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-05-15 09:35:00 UTC
(rev 77396)
@@ -1,3 +1,10 @@
+2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
+
+ * TemplateParser.cs: refactoring - use HttpApplication.LoadType to
+ actually look up types.
+
+ * ControlBuilder.cs: as above
+
2007-05-14 Marek Habersack <[EMAIL PROTECTED]>
* ClientScriptManager.cs: put the hidden field within a <div>, the
Modified: trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs 2007-05-15
08:59:42 UTC (rev 77395)
+++ trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs 2007-05-15
09:35:00 UTC (rev 77396)
@@ -318,40 +318,7 @@
{
}
-#if NET_2_0
- static Type LoadType (string typeName)
- {
- Type type = Type.GetType (typeName);
- if (type != null)
- return type;
-
- IList tla;
- if ((tla = BuildManager.TopLevelAssemblies) != null) {
- foreach (Assembly asm in tla) {
- if (asm == null)
- continue;
- type = asm.GetType (typeName);
- if (type != null)
- return type;
- }
- }
-
- if (!Directory.Exists (PrivateBinPath))
- return null;
-
- string [] binDlls = Directory.GetFiles
(PrivateBinPath, "*.dll");
- foreach (string s in binDlls) {
- Assembly binA = Assembly.LoadFrom (s);
- type = binA.GetType (typeName);
- if (type == null)
- continue;
-
- return type;
- }
-
- return null;
- }
-
+#if NET_2_0
static Type MapTagType (Type tagType)
{
if (tagType == null)
@@ -377,7 +344,7 @@
try {
originalTypeName = tmi.TagType;
- originalType = LoadType
(originalTypeName);
+ originalType = HttpApplication.LoadType
(originalTypeName);
if (originalType == null)
missingType = true;
else
@@ -395,7 +362,7 @@
mappedType = null;
try {
- mappedType = LoadType
(mappedTypeName);
+ mappedType =
HttpApplication.LoadType (mappedTypeName);
if (mappedType == null)
missingType = true;
else
Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs 2007-05-15
08:59:42 UTC (rev 77395)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs 2007-05-15
09:35:00 UTC (rev 77396)
@@ -363,44 +363,17 @@
internal Type LoadType (string typeName)
{
- // First try loaded assemblies, then try assemblies in
Bin directory.
- Type type = null;
- bool seenBin = false;
- Assembly [] assemblies =
AppDomain.CurrentDomain.GetAssemblies ();
- foreach (Assembly ass in assemblies) {
- type = ass.GetType (typeName);
- if (type == null)
- continue;
-
- if (Path.GetDirectoryName (ass.Location) !=
PrivateBinPath) {
- AddAssembly (ass, true);
- } else {
- seenBin = true;
- }
-
- AddDependency (ass.Location);
- return type;
- }
-
- if (seenBin)
+ Type type = HttpApplication.LoadType (typeName);
+ if (type == null)
return null;
+ Assembly asm = type.Assembly;
+ string location = asm.Location;
+
+ AddDependency (location);
+ if (Path.GetDirectoryName (location) != PrivateBinPath)
+ AddAssembly (asm, true);
- // Load from bin
- if (!Directory.Exists (PrivateBinPath))
- return null;
-
- string [] binDlls = Directory.GetFiles (PrivateBinPath,
"*.dll");
- foreach (string s in binDlls) {
- Assembly binA = Assembly.LoadFrom (s);
- type = binA.GetType (typeName);
- if (type == null)
- continue;
-
- AddDependency (binA.Location);
- return type;
- }
-
- return null;
+ return type;
}
void AddAssembliesInBin ()
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-05-15 08:59:42 UTC (rev 77395)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-05-15 09:35:00 UTC (rev 77396)
@@ -1,3 +1,8 @@
+2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
+
+ * ObjectDataSourceView.cs: refactoring - use
+ HttpApplication.LoadType to look up types.
+
2007-05-10 Marek Habersack <[EMAIL PROTECTED]>
* Table.cs: render rows, not controls
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
===================================================================
---
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
2007-05-15 08:59:42 UTC (rev 77395)
+++
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
2007-05-15 09:35:00 UTC (rev 77396)
@@ -483,44 +483,11 @@
return privateBinPath;
}
}
-
- private Type LoadType (string typeName)
- {
- Type type = Type.GetType (typeName);
- if (type != null)
- return type;
-
- IList tla;
- if ((tla = BuildManager.TopLevelAssemblies) != null) {
- foreach (Assembly asm in tla) {
- if (asm == null)
- continue;
- type = asm.GetType (typeName);
- if (type != null)
- return type;
- }
- }
-
- if (!Directory.Exists (PrivateBinPath))
- return null;
-
- string [] binDlls = Directory.GetFiles (PrivateBinPath,
"*.dll");
- foreach (string s in binDlls) {
- Assembly binA = Assembly.LoadFrom (s);
- type = binA.GetType (typeName);
- if (type == null)
- continue;
-
- return type;
- }
-
- return null;
- }
Type ObjectType {
get {
if (objectType == null) {
- objectType = LoadType (TypeName);
+ objectType = HttpApplication.LoadType
(TypeName);
if (objectType == null)
throw new
InvalidOperationException ("Type not found: " + TypeName);
}
@@ -531,7 +498,7 @@
Type DataObjectType {
get {
if (dataObjectType == null) {
- dataObjectType = LoadType
(DataObjectTypeName);
+ dataObjectType =
HttpApplication.LoadType (DataObjectTypeName);
if (dataObjectType == null)
throw new
InvalidOperationException ("Type not found: " + DataObjectTypeName);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches