IJavaScriptConverter.cs
上传用户:szgaoree
上传日期:2009-01-05
资源大小:74k
文件大小:2k
- using System;
- using System.Text;
- using System.Collections;
- namespace AjaxPro
- {
- /// <summary>
- /// Represents an IJavaScriptConverter.
- /// </summary>
- public class IJavaScriptConverter
- {
- /// <summary>
- /// Initializes the converter. This method will be called when the application is starting and
- /// any converter is loaded.
- /// </summary>
- public virtual void Initialize()
- {
- }
- /// <summary>
- /// Render the JavaScript code for prototypes or any other JavaScript method needed from this converter
- /// on the client-side.
- /// </summary>
- /// <returns>Returns JavaScript code.</returns>
- public virtual string GetClientScript()
- {
- return "";
- }
- /// <summary>
- /// Converts an IJavaScriptObject into an NET object.
- /// </summary>
- /// <param name="o">The IJavaScriptObject object to convert.</param>
- /// <param name="type">The type to convert the object to.</param>
- /// <returns>Returns a .NET object.</returns>
- public virtual object Deserialize(IJavaScriptObject o, Type t)
- {
- return null;
- }
- /// <summary>
- /// Converts a .NET object into a JSON string.
- /// </summary>
- /// <param name="o">The object to convert.</param>
- /// <returns>Returns a JSON string.</returns>
- public virtual string Serialize(object o)
- {
- throw new NotImplementedException("Converter for type '" + o.GetType().FullName + "'.");
- }
- /// <summary>
- /// Returns every type that can be used with this converter to serialize an object.
- /// </summary>
- public virtual Type[] SerializableTypes
- {
- get
- {
- return null;
- }
- }
- /// <summary>
- /// Returns every type that can be used with this converter to deserialize an JSON string.
- /// </summary>
- public virtual Type[] DeserializableTypes
- {
- get
- {
- return null;
- }
- }
- }
- }