~ubuntu-branches/ubuntu/trusty/smuxi/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/ServiceStack/src/ServiceStack.Interfaces/Translators/TranslateAttribute.cs

  • Committer: Package Import Robot
  • Author(s): Mirco Bauer
  • Date: 2013-05-25 22:11:31 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130525221131-nd2mc0kzubuwyx20
Tags: 0.8.11-1
* [22d13d5] Imported Upstream version 0.8.11
* [6d2b95a] Refreshed patches
* [89eb66e] Added ServiceStack libraries to smuxi-engine package
* [848ab10] Enable Campfire engine
* [c6dbdc7] Always build db4o for predictable build result
* [13ec489] Exclude OS X specific libraries from dh_clideps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
using System.Text;
 
4
 
 
5
namespace ServiceStack.Translators
 
6
{
 
7
        /// <summary>
 
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.
 
11
        /// </summary>
 
12
        [AttributeUsage(AttributeTargets.Class)]
 
13
        public class TranslateAttribute : Attribute
 
14
        {
 
15
                public string SourceMethodPrefix { get; set; }
 
16
                public string TargetMethodPrefix { get; set; }
 
17
                public Type SourceType { get; set; }
 
18
                public Type TargetType { get; set; }
 
19
 
 
20
                public TranslateAttribute(Type targetType) 
 
21
                        : this(null, targetType) {}
 
22
 
 
23
                public TranslateAttribute(string sourceExtensionPrefix, Type targetType, string targetExtensionPrefix)
 
24
                        : this(null, sourceExtensionPrefix, targetType, targetExtensionPrefix) { }
 
25
 
 
26
                protected TranslateAttribute(Type sourceType, Type targetType)
 
27
                {
 
28
                        this.SourceType = sourceType;
 
29
                        this.TargetType = targetType;
 
30
                }
 
31
 
 
32
                protected TranslateAttribute(Type sourceType, string sourceExtensionPrefix, Type targetType, string targetExtensionPrefix)
 
33
                {
 
34
                        this.SourceType = sourceType;
 
35
                        this.SourceMethodPrefix = sourceExtensionPrefix;
 
36
                        this.TargetType = targetType;
 
37
                        this.TargetMethodPrefix = targetExtensionPrefix;
 
38
                }
 
39
        }
 
40
}