Example #1
0
 internal BulkReader(IServiceProvider locator, IDatabaseQuery query, ChunkedMemoryStream stream)
 {
     this.Locator = locator;
     this.Query   = query;
     this.Stream  = stream;
     this.Writer  = stream.GetWriter();
     Stream.Reset();
     Writer.Write("SELECT (");
 }
Example #2
0
        public static void Serialize(this IJsonObject instance, ChunkedMemoryStream stream)
        {
            stream.Reset();
            var sw = stream.GetWriter();

            instance.Serialize(sw, false, null);
            sw.Flush();
            stream.Position = 0;
        }
        public Context(IServiceProvider service)
        {
            Stream = ChunkedMemoryStream.Static();
            Writer = Stream.GetWriter();
            var dqm     = service.Resolve <IDatabaseQueryManager>();
            var factory = service.Resolve <IObjectFactory>().CreateInnerFactory();

            factory.RegisterInterfaces(dqm.StartQuery(false));
            Repository = factory.Resolve <IPersistableRepository <World> >();
            BulkReader = factory.BulkRead(ChunkedMemoryStream.Static());
        }
Example #4
0
        public static Stream Render(IHtmlView html, IResponseContext response, ChunkedMemoryStream stream)
        {
            stream.Reset();
            response.ContentType = "text/html; charset=UTF-8";
            var sw = stream.GetWriter();

            html.Render(sw);
            sw.Flush();
            response.ContentLength = stream.Position;
            stream.Position        = 0;
            return(stream);
        }
Example #5
0
        public static void Serialize(this IList <IJsonObject> values, ChunkedMemoryStream stream)
        {
            stream.Reset();
            var sw = stream.GetWriter();

            sw.Write('[');
            if (values.Count > 0)
            {
                values[0].Serialize(sw, false, null);
                for (int i = 1; i < values.Count; i++)
                {
                    sw.Write(',');
                    values[i].Serialize(sw, false, null);
                }
            }
            sw.Write(']');
            sw.Flush();
            stream.Position = 0;
        }
Example #6
0
        public static void Serialize(this IJsonObject[] array, ChunkedMemoryStream stream, int len)
        {
            stream.Reset();
            var sw = stream.GetWriter();

            sw.Write('[');
            if (len > 0)
            {
                array[0].Serialize(sw, false, null);
                for (int i = 1; i < len; i++)
                {
                    sw.Write(',');
                    array[i].Serialize(sw, false, null);
                }
            }
            sw.Write(']');
            sw.Flush();
            stream.Position = 0;
        }
Example #7
0
        public static void Serialize(this IJsonObject[] array, ChunkedMemoryStream stream)
        {
            stream.Reset();
            var sw = stream.GetWriter();

            sw.Write('[');
            if (array.Length > 0)
            {
                array[0].Serialize(sw, stream.SmallBuffer, false, null);
                for (int i = 1; i < array.Length; i++)
                {
                    sw.Write(',');
                    array[i].Serialize(sw, stream.SmallBuffer, false, null);
                }
            }
            sw.Write(']');
            sw.Flush();
            stream.Position = 0;
        }
Example #8
0
        public static void Serialize <T>(this ArraySegment <T> segment, ChunkedMemoryStream stream)
            where T : IJsonObject
        {
            stream.Reset();
            var sw = stream.GetWriter();

            sw.Write('[');
            if (segment.Count > 0)
            {
                var array = segment.Array;
                var off   = segment.Offset;
                array[off].Serialize(sw, false, null);
                for (int i = 1; i < segment.Count; i++)
                {
                    sw.Write(',');
                    array[off + i].Serialize(sw, false, null);
                }
            }
            sw.Write(']');
            sw.Flush();
            stream.Position = 0;
        }