标签:core 新建 str util host gen pre fse ring
序列化 序列化配置有几个坑这里我写出来
新建实体类
引用的包
Microsoft.Orleans.Core V2.12
Microsoft.Orleans.OrleansCodeGenerator.Build V2.12
Microsoft.Orleans.Serialization.Bond V2.12
using Bond; using System; namespace Entity { [Schema] [Serializable] public class GoodsEntity { public int ID { get; set; } public string GoodsName { get; set; } } }
两个标签缺一不可
所有的简仓全部需要配置 包括用来做网关的
添加包
Microsoft.Orleans.OrleansGoogleUtils V2.12
var builder = new SiloHostBuilder() .Configure<SerializationProviderOptions>(d => { d.SerializationProviders.Add(typeof(ProtobufSerializer).GetTypeInfo()); d.FallbackSerializationProvider = typeof(ProtobufSerializer).GetTypeInfo(); })
所有的客户端全部需要配置
IClusterClient client = new ClientBuilder() .Configure<SerializationProviderOptions>(d => { d.SerializationProviders.Add(typeof(ProtobufSerializer).GetTypeInfo()); d.FallbackSerializationProvider = typeof(ProtobufSerializer).GetTypeInfo(); })
然后传递就可以用对象保存了
标签:core 新建 str util host gen pre fse ring
原文地址:https://www.cnblogs.com/AnAng/p/9903617.html