public void AddProto(DefTypeBase proto) { if (!id2Protos.TryAdd(proto.Id, proto)) { throw new Exception($"proto:'{proto.FullName}' id:{proto.Id} duplicated with '{id2Protos[proto.Id].FullName}'"); } }
public string RenderAny(DefTypeBase o) { switch (o) { case DefEnum e: return(Render(e)); case DefBean b: return(Render(b)); case DefTable r: return(Render(r)); default: throw new Exception($"unknown render type:'{o}'"); } }
public static string CsCloneToExternal(DefTypeBase type, string src) { var mapper = type.CurrentExternalTypeMapper; if (mapper == null) { return(src); } if (string.IsNullOrWhiteSpace(mapper.CreateExternalObjectFunction)) { throw new Exception($"type:{type.FullName} externaltype:{type.ExternalType.Name} lan:{mapper.Lan} selector:{mapper.Selector} 未定义clone_to_external元素"); } return($"{mapper.CreateExternalObjectFunction}({src})"); }
public DefField(DefTypeBase host, Field f, int idOffset) : base(host, f, idOffset) { }
public static string CsMapperToExternalType(DefTypeBase type) { var mapper = type.CurrentExternalTypeMapper; return(mapper != null ? mapper.TypeName : type.CsFullName); }