Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. [ServiceContract]
  2. [ServiceKnownType(typeof(ActionParameters))]
  3. [ServiceKnownType(typeof(SportProgram))]
  4. [ServiceKnownType(typeof(ActionResult<SportProgram>))]
  5. public interface ISportProgramBl
  6. {
  7. [OperationContract]
  8. IActionResult<ISportProgram> Get(IActionParameters parameters);
  9. }
  10.  
  11. [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
  12. [System.ServiceModel.ServiceContractAttribute(ConfigurationName="SportProgramStb.ISportProgramBl")]
  13. public interface ISportProgramBl {
  14.  
  15. [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISportProgramBl/Get", ReplyAction="http://tempuri.org/ISportProgramBl/GetResponse")]
  16. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(PPS.Core.DomainModel.SportProgram.SportProgram))]
  17. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(PPS.Core.DomainModel.Support.Action.ActionParameters))]
  18. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(PPS.Core.DomainModel.Support.Action.ActionResult<PPS.Core.DomainModel.SportProgram.SportProgram>))]
  19. object Get(object parameters);
  20. }
  21.  
  22. public interface IActionResult<T>
  23. {
  24. T Result { get; set; }
  25. }
  26.  
  27. PPS.Core.DomainModel.Support.Action.ActionListResult<IList<PPS.Core.DomainModel.SportProgram.ISportProgram>>
  28.  
  29. [ServiceContract]
  30. [ServiceKnownType(typeof(CollectionWrapper<IAssociation>))]
  31. public interface IService :
  32. {
  33. [OperationContract]
  34. ICollectionWrapper<IAssociation> FindAssociation(string name, int pageSize, int page);
  35. }
  36.  
  37. public interface ICollectionWrapper<TModel>
  38. {
  39. int TotalCount { get; set; }
  40. IEnumerable<TModel> Items { get; set; }
  41. }
  42.  
  43. [KnownType(typeof(OrganizationDto))]
  44. [KnownType(typeof(CompanyDto))]
  45. public class CollectionWrapper<TModel> : ICollectionWrapper<TModel>
  46. {
  47. [DataMember]
  48. public int TotalCount { get; set; }
  49. [DataMember]
  50. public IEnumerable<TModel> Items { get; set; }
  51. }
  52.  
  53. public class CompanyDto : IAssociation
  54. {
  55. public int Id { get; set; }
  56. public string Name { get; set; }
  57. }
  58.  
  59. public class OrganizationDto : IAssociation
  60. {
  61. public int Id { get; set; }
  62. public string Name { get; set; }
  63. }
  64.  
  65. [ServiceContract]
  66. [ServiceKnownType(typeof(ActionParameters))]
  67. [ServiceKnownType(typeof(ActionResult<ISportProgram>))] // Actual implementation of container, but interface of generic.
  68. public interface ISportProgramBl
  69. {
  70. [OperationContract]
  71. IActionResult<ISportProgram> Get(IActionParameters parameters);
  72. }
  73.  
  74. [KnownType(typeof(SportProgram))] // Actual implementation here.
  75. public class ActionResult<T>
  76. {
  77. // Other stuff here
  78. T FooModel { get; set; }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement