Adding protobuf serialization to generated classes

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
SkeLLLa
Posts: 2
Joined: Mon 11 Feb 2013 10:39

Adding protobuf serialization to generated classes

Post by SkeLLLa » Mon 11 Feb 2013 11:01

Hello. I'm using Entity developer with postgres and I need to replace standart serialization for generated classes with protbuf serialization. So I need something like this:

Code: Select all

 [Serializable]
 [ProtoContract]
 public partial class MyClass : EntityObject
 {
  [ProtoMember(1)]
  public string Attribute1 { get {...}, set{...}}
  [ProtoMember(2)]
  public string Attribute2 { get {...}, set{...}}
  ...
 }
What I need to change in template to get such output?

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Adding protobuf serialization to generated classes

Post by Shalex » Wed 13 Feb 2013 10:52

There are two alternative ways:
1. Add the reference to the assembly with the protbuf serialization attributes via Model > Settings > Model > Attributes. After this, add the needed attributes to the model and its separate classes.
2. Right click on the template in Model Explorer > Copy to Model Folder. Modify the template to generate the protbuf serialization attributes in the code.

SkeLLLa
Posts: 2
Joined: Mon 11 Feb 2013 10:39

Re: Adding protobuf serialization to generated classes

Post by SkeLLLa » Thu 14 Feb 2013 12:31

Yes. Thanks. I've already modified template and generated proper classes. Also I've added

Code: Select all

[ProtoContract(UseProtoMembersOnly=true)]
to avoid serialization of reverences (Navigation properties)

Post Reply