Created
September 29, 2014 20:55
-
-
Save mmertsock/83980288833deb79dec1 to your computer and use it in GitHub Desktop.
Add ServiceStack Reference codegen issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using ServiceStack; | |
namespace AddSsRefHost.ServiceModel | |
{ | |
[Route("/hello/{Name}")] | |
public class Hello : IReturn<HelloResponse> | |
{ | |
public string Name { get; set; } | |
public NestedClass NestedClassProp { get; set; } | |
public EnumType EnumProp { get; set; } | |
// This will generate a class definition "public partial class Hello.NestedClass" | |
public class NestedClass | |
{ | |
public string Value { get; set; } | |
} | |
} | |
// Enum types aren't included in the generated code | |
public enum EnumType | |
{ | |
Value1, | |
Value2 | |
} | |
// This will generate a class definition "public partial class QueryResult<ResponseItem>" | |
public class HelloResponse : QueryResult<ResponseItem> | |
{ | |
public string Result { get; set; } | |
} | |
public class ResponseItem | |
{ | |
public string Value { get; set;} | |
} | |
public abstract class QueryResult<TItem> | |
{ | |
public List<TItem> Items { get; set; } | |
} | |
/* The generated code for the above looks like this, when using the 4.0.32 MyGet build: | |
[Route("/hello/{Name}")] | |
public partial class Hello | |
: IReturn<HelloResponse> | |
{ | |
public virtual string Name { get; set; } | |
public virtual Hello.NestedClass NestedClassProp { get; set; } | |
public virtual EnumType EnumProp { get; set; } | |
} | |
public partial class Hello.NestedClass | |
{ | |
public virtual string Value { get; set; } | |
} | |
public partial class HelloResponse | |
: QueryResult<ResponseItem> | |
{ | |
public virtual string Result { get; set; } | |
} | |
public partial class QueryResult<ResponseItem> | |
{ | |
public QueryResult() | |
{ | |
Items = new List<ResponseItem>{}; | |
} | |
public virtual List<ResponseItem> Items { get; set; } | |
} | |
public partial class ResponseItem | |
{ | |
public virtual string Value { get; set; } | |
} | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment