-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
27 lines (24 loc) · 854 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Reflection;
using ProtoBuf.Meta;
namespace MonoSerBuilder
{
class Program
{
static void Main(string[] args)
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
var model = TypeModel.Create();
var type = Type.GetType("MonoDto.OrderHeader, MonoDto");
model.Add(type, true);
type = Type.GetType("MonoDto.OrderDetail, MonoDto");
model.Add(type, true);
model.Compile("OrderSerializer", "MonoDtoSerializer.dll");
}
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name.StartsWith("protobuf-net")) return typeof (ProtoBuf.Serializer).Assembly;
return null;
}
}
}