public void Setup()
        {
            _data = File.ReadAllBytes("test.bin");
            var model = RuntimeTypeModel.Create();

            model.Add(typeof(Database), true);
            model.Add(typeof(Order), true);
            model.Add(typeof(OrderLine), true);
            model.CompileInPlace();
            _cip = model;
            _c   = model.Compile();
#if WRITE_DLL
            _dll = model.Compile("MySerializer", "DalSerializer.dll");
            Console.WriteLine("Serializer written to " + Directory.GetCurrentDirectory());
#endif
#if NEW_API
            _auto = RuntimeTypeModel.CreateForAssembly <Database>();
#endif

#pragma warning disable CS0618
            using var reader = ProtoReader.Create(Exposable(_data), model);
            _database        = (Database)model.Deserialize(reader, null, typeof(Database));
            _googleModel     = protoc.Database.Parser.ParseFrom(_data);
#pragma warning restore CS0618
        }
Exemplo n.º 2
0
        public void Setup()
        {
            _data = File.ReadAllBytes("test.bin");
            var model = RuntimeTypeModel.Create();

            model.Add(typeof(protogen.Database), true);
            model.Add(typeof(protogen.Order), true);
            model.Add(typeof(protogen.OrderLine), true);
            model.CompileInPlace();
            _cip = model;
            _c   = model.Compile();
#if !(NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP3_0)
            _dll = model.Compile("MySerializer", "DalSerializer.dll");
#endif
            _auto = RuntimeTypeModel.CreateForAssembly <protogen.Database>();
        }
Exemplo n.º 3
0
        public void Setup()
        {
            _data = File.ReadAllBytes("test.bin");
            var model = RuntimeTypeModel.Create();

            model.Add(typeof(protogen.Database), true);
            model.Add(typeof(protogen.Order), true);
            model.Add(typeof(protogen.OrderLine), true);
//#if NEW_API
//            model.Add(typeof(protogen.pooled.Database));
//            model.Add(typeof(protogen.pooled.Order));
//            model.Add(typeof(protogen.pooled.OrderLine));
//#endif
            model.CompileInPlace();
            _cip = model;
            _c   = model.Compile();
#if WRITE_DLL
            _dll = model.Compile("MySerializer", "DalSerializer.dll");
#endif
#if NEW_API
            _auto = RuntimeTypeModel.CreateForAssembly <protogen.Database>();
#endif
        }