Exemplo n.º 1
0
        public CsharpManyContractsWrapper(CsharpEmitterOptions options, CsharpTemplateContext contextMaker)
        {
            _options      = options;
            _contextMaker = contextMaker;
            _template     = Template.Parse(
                @"using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace {{ namespace }} {
{{ contracts | ident }}
}");
        }
        public CsharpContractGenericStringify(IContractFieldStringify fieldStringify, CsharpEmitterOptions options, CsharpTemplateContext contextMaker)
        {
            _fieldStringify = fieldStringify;
            _options        = options;
            _contextMaker   = contextMaker;
            _template       = Template.Parse(@"{{~ if description ~}}
/// <summary>
/// {{ description }}
/// </summary>
{{~ end ~}}
{{~ if is_deprecated ~}}
[Obsolete(""{{ deprecation_cause }}"")]
{{~ end ~}}
public {{ if can_be_partial }}partial {{ end }}class {{ class_name }}<{{ genericargs }}> {

{{~ for field in fields ~}}
{{ field | ident }}

{{~ end ~}}
}");
        }
Exemplo n.º 3
0
        public CsharpContractEnumStringify(IEnumFieldStringify fieldStringify, CsharpEmitterOptions options, CsharpTemplateContext contextMaker)
        {
            _fieldStringify = fieldStringify;
            _options        = options;
            _contextMaker   = contextMaker;
            _template       = Template.Parse(@"{{~ if description ~}}
/// <summary>
/// {{ description }}
/// </summary>
{{~ end ~}}
{{~ if is_deprecated ~}}
[Obsolete(""{{ deprecation_cause }}"")]
{{~ end ~}}
{{~ if json_converter ~}}
[JsonConverter(typeof({{ json_converter }}))]
{{~ end ~}}
public enum {{ enum_name }} {

{{~ for field in fields ~}}
{{ field | ident }}

{{~ end ~}}
}");
        }