2
using System.Collections.Generic;
5
namespace ServiceStack.Translators
8
/// This instructs the generator tool to generate translator methods for the types supplied.
9
/// A {TypeName}.generated.cs partial class will be generated that contains the methods required
10
/// to generate to and from that type.
12
[AttributeUsage(AttributeTargets.Class)]
13
public class TranslateAttribute : Attribute
15
public string SourceMethodPrefix { get; set; }
16
public string TargetMethodPrefix { get; set; }
17
public Type SourceType { get; set; }
18
public Type TargetType { get; set; }
20
public TranslateAttribute(Type targetType)
21
: this(null, targetType) {}
23
public TranslateAttribute(string sourceExtensionPrefix, Type targetType, string targetExtensionPrefix)
24
: this(null, sourceExtensionPrefix, targetType, targetExtensionPrefix) { }
26
protected TranslateAttribute(Type sourceType, Type targetType)
28
this.SourceType = sourceType;
29
this.TargetType = targetType;
32
protected TranslateAttribute(Type sourceType, string sourceExtensionPrefix, Type targetType, string targetExtensionPrefix)
34
this.SourceType = sourceType;
35
this.SourceMethodPrefix = sourceExtensionPrefix;
36
this.TargetType = targetType;
37
this.TargetMethodPrefix = targetExtensionPrefix;