public IContextLinkageOptions CreateContextLinkageOptions(ContextLinkageDiscoveryMode contextLinkageDiscoveryMode, Maybe <string> specificContextId = default) { var obj = ContextLinkageOptions.Rent(); obj.Mode = contextLinkageDiscoveryMode; obj.SpecificContext = specificContextId; return(obj); }
private ContextLinkageOptions ConvertToProto(IContextLinkageOptions obj) { var proto = ContextLinkageOptions.Rent(); if (obj != null) { switch (obj.Mode) { case ContextLinkageDiscoveryMode.None: proto.ClearMode(); break; case ContextLinkageDiscoveryMode.SpecificContext: proto.SpecificContextId = obj.SpecificContext.Value; break; case ContextLinkageDiscoveryMode.CurrentContext: proto.CurrentContext = Empty.Instance; break; } } return(proto); }