示例#1
0
        private static string GetSchemaForType(Type type, bool removePackage)
        {
            var schema = MessageUtils.GetSchema(type);

            if (removePackage)
            {
                var builder = new StringBuilder();
                foreach (var myString in schema.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (myString.Contains("package"))
                    {
                        continue;
                    }
                    builder.AppendLine(myString);
                }
                schema = builder.ToString();
            }
            return(schema);
        }
示例#2
0
 /// <summary>
 /// Returns the .proto schema for your model
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(MessageUtils.GetSchema(GetType()));
 }