protected LogicalTypeInfo (Type t, string filePath)
{
_type = t;
bool isPage = _type.IsSubclassOf (typeof (System.Web.UI.Page));
var logicalMethods = GetLogicalMethods (isPage);
//_logicalMethods = (LogicalMethodInfo []) list.ToArray (typeof (LogicalMethodInfo));
_methodMap = new Hashtable (logicalMethods.Count);
for (int i = 0; i < logicalMethods.Count; i++)
_methodMap.Add (logicalMethods [i].MethodName, logicalMethods [i]);
string ns;
string service;
GetNamespaceAndServiceName (t, isPage, out ns, out service);
StringBuilder proxy = new StringBuilder ();
List<string> registeredNamespaces = new List<string> ();
string scriptTypeDeclaration = EnsureNamespaceRegistered (ns, service, proxy, registeredNamespaces);
proxy.AppendFormat (
@"
" + scriptTypeDeclaration + @"=function() {{
{0}.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}}
{0}.prototype={{",
service);
for (int i = 0; i < logicalMethods.Count; i++) {
if (i > 0)
proxy.Append (',');
logicalMethods [i].GenerateMethod (proxy, true, isPage);
}
proxy.AppendFormat (
@"}}
{0}.registerClass('{0}',Sys.Net.WebServiceProxy);
{0}._staticInstance = new {0}();
{0}.set_path = function(value) {{ {0}._staticInstance.set_path(value); }}
{0}.get_path = function() {{ return {0}._staticInstance.get_path(); }}
{0}.set_timeout = function(value) {{ {0}._staticInstance.set_timeout(value); }}
{0}.get_timeout = function() {{ return {0}._staticInstance.get_timeout(); }}
{0}.set_defaultUserContext = function(value) {{ {0}._staticInstance.set_defaultUserContext(value); }}
{0}.get_defaultUserContext = function() {{ return {0}._staticInstance.get_defaultUserContext(); }}
{0}.set_defaultSucceededCallback = function(value) {{ {0}._staticInstance.set_defaultSucceededCallback(value); }}
{0}.get_defaultSucceededCallback = function() {{ return {0}._staticInstance.get_defaultSucceededCallback(); }}
{0}.set_defaultFailedCallback = function(value) {{ {0}._staticInstance.set_defaultFailedCallback(value); }}
{0}.get_defaultFailedCallback = function() {{ return {0}._staticInstance.get_defaultFailedCallback(); }}
{0}.set_path(""{1}"");",
service, filePath);
for (int i = 0; i < logicalMethods.Count; i++)
logicalMethods [i].GenerateMethod (proxy, false, isPage);
GenerateTypeRegistrationScript (proxy, registeredNamespaces);
proxy.AppendLine ();
_proxy = proxy.ToString ();
}