/// <summary> /// Apply include mappings via assembly reflection (<see cref="ProtoBaseAttribute"/>).<br /> /// Important: This must be called before any serialization happen. /// </summary> /// <param name="model">The RuntimeTypeModel</param> /// <param name="assemblyRegexFilter">The regex assembly filer</param> /// <param name="implicitFields">The default import of base type fields, if nothing is specified.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="InvalidDataException"></exception> public static void ApplyProtoBase(this RuntimeTypeModel model, Regex assemblyRegexFilter, ImplicitFields implicitFields = ImplicitFields.AllPublic) { model.ApplyProtoBase(assembly => assemblyRegexFilter == null || assemblyRegexFilter.IsMatch(assembly.FullName), implicitFields); }
public void Startup() { _model = RuntimeTypeModel.Create(); _model.ApplyProtoBase(assembly => assembly == GetType().Assembly); }
/// <summary> /// Apply include mappings via assembly reflection (<see cref="ProtoBaseAttribute"/>).<br /> /// Important: This must be called before any serialization happen. /// </summary> /// <param name="model">The RuntimeTypeModel</param> /// <param name="implicitFields">The default import of base type fields, if nothing is specified.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="InvalidDataException"></exception> public static void ApplyProtoBase(this RuntimeTypeModel model, ImplicitFields implicitFields = ImplicitFields.AllPublic) { model.ApplyProtoBase(assembly => true, implicitFields); }