Author Topic: Generate code in C#  (Read 2520 times)

fabio lima

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Generate code in C#
« on: December 03, 2013, 11:05:47 am »
Hello,

I would like to generate the following output from a class in C #

    public class User
    {
        public string Username { get; set; }
        public string Password { get; set; }
    }

Can provide me the script for this?

Thanks,

Fábio

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8063
  • Karma: +118/-20
    • View Profile
Re: Generate code in C#
« Reply #1 on: December 03, 2013, 11:16:44 am »
Apart from spacing, that's what you'll get for an operation stereotyped as "property" if no attribute_name tagged value exists.

Code: [Select]
%if elemType == "Interface" or opAbstract == "T" or opTag:"attribute_name"==""%
%if opTag:"writeonly" == ""%
$read="\tget;"
%endIf%
%if opTag:"readonly" == ""%
$write="\tset;"
%endIf%

{
$wrap = %genOptWrapComment=="-1" ? "-1" : "40"%
$behavior = %WRAP_LINES(opBehavior, $wrap, "\t//", "")%
%if $behavior != ""%
$behavior\n
%endIf%

$code = %WRAP_LINES(opCode, "-1", "\t", "")%
%if $code != ""%
$code
%else%
$read
$write
%endIf%
}
%endTemplate%

fabio lima

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Generate code in C#
« Reply #2 on: December 03, 2013, 08:50:47 pm »
Simon,

Thank you very much for your help. I'll be out all morning, but I'll take the tests today in the afternoon.
Return to post when finished.

Super hug!!!