示例#1
0
 public void marshall(Object o, TextWriter w, IBaseMarshaller baseMarshaller,int flags, int depth)
 {
     if(o is IDataReader)
         throw new ArgumentOutOfRangeException(
                     String.Format(	"Expected IDataReader in DataReaderMarshaller but got {0}"
                                     ,o.GetType().ToString()));
     // Start the list of data sets
     w.Write("(:result ");
     // We have to close it when we are done.
     using(IDataReader	dr	=	(IDataReader)o)
     {
         do
         {
             // First write out the fields
             w.Write("(:result-set (:columns #(");
             for(int i=0;i<dr.FieldCount;++i)
                 w.Write("((:name {0})(:type {1}))",dr.GetName(i),dr.GetDataTypeName(i));
             w.Write(")) ");
             // Write out the data as a list of vectors
             w.Write("(:rows ");
             // Each row...
             while(dr.Read())
             {
                 w.Write("#(");
                 for(int i=0;i<dr.FieldCount;++i)
                     baseMarshaller.marshallAtom(dr.GetValue(i),w,flags,depth);
                 w.Write(") ");
             }
             w.Write("))");
         } while(dr.NextResult());
     }
     w.Write(")");
 }
示例#2
0
        String createRetString(Object o, IBaseMarshaller marshaller, int flags, int depth)
        {
            StringWriter sw = new StringWriter();

            sw.Write("(:ret");
            marshaller.marshallAtom(o, sw, flags, depth);
            sw.Write(')');
            return(sw.ToString());
        }
        public RuntimeServer(	IReader reader
							, IBaseMarshaller marshaller
							, IReferenceManager referenceManager
							, IReflector reflector
						)
        {
            this.reader				= reader;
            this.marshaller			= marshaller;
            this.referenceManager	= referenceManager;
            this.reflector			= reflector;
        }
示例#4
0
 public RuntimeServer(IReader reader
                      , IBaseMarshaller marshaller
                      , IReferenceManager referenceManager
                      , IReflector reflector
                      )
 {
     this.reader           = reader;
     this.marshaller       = marshaller;
     this.referenceManager = referenceManager;
     this.reflector        = reflector;
 }
示例#5
0
 public void marshall(Object o, TextWriter w, IBaseMarshaller baseMarshaller, int flags, int depth)
 {
     if (o.GetType().IsArray)
     {
         baseMarshaller.marshallAsVector(o, w, flags, depth);
     }
     else if (baseMarshaller.canMarshallAsList(o))
     {
         baseMarshaller.marshallAsVector(o, w, flags, depth);
     }
     else if (o is Type)
     {
         baseMarshaller.marshallAtom(o.ToString(), w, flags, depth);
     }
     else
     {
         try
         {
             w.Write(" (");
             PropertyInfo[] props = o.GetType().GetProperties();
             for (int i = 0; i < props.Length; i++)
             {
                 PropertyInfo prop = props[i];
                 //skip getClass generated property
                 if (prop.Name.Equals("object"))
                 {
                     continue;
                 }
                 MethodInfo m = props[i].GetGetMethod();
                 //must be no-arg property getter
                 if (m != null && m.GetParameters().Length == 0)
                 {
                     w.Write("(:");                             //sent as keyword
                     w.Write(prop.Name);
                     w.Write(" . ");
                     baseMarshaller.marshallAtom(m.Invoke(o, null), w, flags, depth);
                     w.Write(')');
                 }
             }
             w.Write(')');
         }
         catch (Exception ex)
         {
             throw new IOException(ex.ToString());
         }
     }
 }
 public void marshall(Object o, TextWriter w, IBaseMarshaller baseMarshaller,int flags, int depth)
 {
     if(o.GetType().IsArray)
         baseMarshaller.marshallAsVector(o,w,flags,depth);
     else if(baseMarshaller.canMarshallAsList(o))
         baseMarshaller.marshallAsVector(o,w,flags,depth);
     else if(o is Type)
         baseMarshaller.marshallAtom(o.ToString(),w,flags,depth);
     else
     {
         try
         {
             w.Write(" (");
             PropertyInfo[] props = o.GetType().GetProperties();
             for(int i=0;i<props.Length;i++)
             {
                 PropertyInfo prop = props[i];
                 //skip getClass generated property
                 if(prop.Name.Equals("object"))
                     continue;
                 MethodInfo m = props[i].GetGetMethod();
                 //must be no-arg property getter
                 if(m != null && m.GetParameters().Length == 0)
                 {
                     w.Write("(:"); //sent as keyword
                     w.Write(prop.Name);
                     w.Write(" . ");
                     baseMarshaller.marshallAtom(m.Invoke(o,null),w,flags,depth);
                     w.Write(')');
                 }
             }
             w.Write(')');
         }
         catch(Exception ex)
         {
             throw new IOException(ex.ToString());
         }
     }
 }
示例#7
0
 public void marshall(Object o, TextWriter w, IBaseMarshaller baseMarshaller, int flags, int depth)
 {
     if (o is IDataReader)
     {
         throw new ArgumentOutOfRangeException(
                   String.Format("Expected IDataReader in DataReaderMarshaller but got {0}"
                                 , o.GetType().ToString()));
     }
     // Start the list of data sets
     w.Write("(:result ");
     // We have to close it when we are done.
     using (IDataReader dr = (IDataReader)o)
     {
         do
         {
             // First write out the fields
             w.Write("(:result-set (:columns #(");
             for (int i = 0; i < dr.FieldCount; ++i)
             {
                 w.Write("((:name {0})(:type {1}))", dr.GetName(i), dr.GetDataTypeName(i));
             }
             w.Write(")) ");
             // Write out the data as a list of vectors
             w.Write("(:rows ");
             // Each row...
             while (dr.Read())
             {
                 w.Write("#(");
                 for (int i = 0; i < dr.FieldCount; ++i)
                 {
                     baseMarshaller.marshallAtom(dr.GetValue(i), w, flags, depth);
                 }
                 w.Write(") ");
             }
             w.Write("))");
         } while(dr.NextResult());
     }
     w.Write(")");
 }
 String createRetString(Object o,IBaseMarshaller marshaller,int flags,int depth)
 {
     StringWriter sw = new StringWriter();
     sw.Write("(:ret");
     marshaller.marshallAtom(o,sw,flags,depth);
     sw.Write(')');
     return sw.ToString();
 }
 public Reflector(IBaseMarshaller baseMarshaller)
 {
     this.baseMarshaller = baseMarshaller;
 }
示例#10
0
 public Reflector(IBaseMarshaller baseMarshaller)
 {
     this.baseMarshaller = baseMarshaller;
 }