leejw51 / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
0 stars 0 forks source link

[V1] Add option to make the generated properties 'protected' instead of 'public' #186

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I would like to add the option 'make_properties_protected' and expose it to my 
.proto files.

So when protobuf-net converts my .proto files into .cs files, I could let it 
make the properties 'protected' if the option is defined.

Reason is that I use a custom convert system (using PostSharp) that automaticly 
maps the 'lowercase' (protobuf) properties to the 'CamelCase' PostSharp 
properties (in a partial class).

I want to be able to make the protobuf properties protected, so that the devs 
can only access the 'public' PostSharp properties.

Any idea how to implement this? I got most of the xslt done, but I don't know 
how to add the actual option.

Original issue reported on code.google.com by tim@mylemans.com on 14 Jun 2011 at 9:31

GoogleCodeExporter commented 9 years ago
Or any aid on adding 'an' option (that I can read at 'generation time') would 
be good as well - the rest I know how to do :)

Original comment by tim@mylemans.com on 14 Jun 2011 at 12:56

GoogleCodeExporter commented 9 years ago
All the options are handled internally at the xslt level via xsl parameters. 
Parameters for the transform are handled automatically when prefixing with /p 
(IIRC), so really all you should need to do is add the xsl:parameter

Original comment by marc.gravell on 14 Jun 2011 at 7:16

GoogleCodeExporter commented 9 years ago
I have that part, but I like to be able to 'set' the option from within my 
.proto files (so I can use it whenever I feel the need for it) 

FYI, I use the 'custom tool' from within vs.

Original comment by tim@mylemans.com on 14 Jun 2011 at 8:13

GoogleCodeExporter commented 9 years ago
That isn't directly supported at the moment. I have an existing task to look at 
how this data presents itself in the model to see if I can present it to the 
xml, but I don't have that currently.

Original comment by marc.gravell on 14 Jun 2011 at 8:21

GoogleCodeExporter commented 9 years ago
Ok, I'm working around it (almost done) by patching v1.

Idea is to add a project option to define the property' visibility (default 
public)

Would anyone be interested in this? If so, do tell, and I'll clean it up :)

Also, doing the same for specifying extra proto paths (currently I'm just 
trying to add the 'project' folder as a test, but the goal is to make it an 
option)

Original comment by tim@mylemans.com on 4 Jul 2011 at 8:15