| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using CoreWCF.Description; |
| | | 6 | | |
| | | 7 | | namespace CoreWCF |
| | | 8 | | { |
| | | 9 | | [AttributeUsage(CoreWCFAttributeTargets.ServiceContract, Inherited = false, AllowMultiple = false)] |
| | | 10 | | public sealed class ServiceContractAttribute : Attribute |
| | | 11 | | { |
| | | 12 | | private string _configurationName; |
| | | 13 | | private string _name; |
| | | 14 | | private string _ns; |
| | | 15 | | private SessionMode _sessionMode; |
| | | 16 | | |
| | | 17 | | public string ConfigurationName |
| | | 18 | | { |
| | 678 | 19 | | get { return _configurationName; } |
| | | 20 | | set |
| | | 21 | | { |
| | 62 | 22 | | if (value == null) |
| | | 23 | | { |
| | 0 | 24 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value)); |
| | | 25 | | } |
| | 62 | 26 | | if (value == string.Empty) |
| | | 27 | | { |
| | 0 | 28 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val |
| | 0 | 29 | | SR.SFxConfigurationNameCannotBeEmpty)); |
| | | 30 | | } |
| | 62 | 31 | | _configurationName = value; |
| | 62 | 32 | | } |
| | | 33 | | } |
| | | 34 | | |
| | | 35 | | public string Name |
| | | 36 | | { |
| | 678 | 37 | | get { return _name; } |
| | | 38 | | set |
| | | 39 | | { |
| | 3740 | 40 | | if (value == null) |
| | | 41 | | { |
| | 0 | 42 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value)); |
| | | 43 | | } |
| | 3740 | 44 | | if (value == string.Empty) |
| | | 45 | | { |
| | 0 | 46 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val |
| | 0 | 47 | | SR.SFxNameCannotBeEmpty)); |
| | | 48 | | } |
| | 3740 | 49 | | _name = value; |
| | 3740 | 50 | | } |
| | | 51 | | } |
| | | 52 | | |
| | | 53 | | public string Namespace |
| | | 54 | | { |
| | 678 | 55 | | get { return _ns; } |
| | | 56 | | set |
| | | 57 | | { |
| | 3716 | 58 | | if (!string.IsNullOrEmpty(value)) |
| | | 59 | | { |
| | 3530 | 60 | | NamingHelper.CheckUriProperty(value, "Namespace"); |
| | | 61 | | } |
| | | 62 | | |
| | 3716 | 63 | | _ns = value; |
| | 3716 | 64 | | } |
| | | 65 | | } |
| | | 66 | | |
| | | 67 | | public SessionMode SessionMode |
| | | 68 | | { |
| | 678 | 69 | | get { return _sessionMode; } |
| | | 70 | | set |
| | | 71 | | { |
| | 296 | 72 | | if (!SessionModeHelper.IsDefined(value)) |
| | | 73 | | { |
| | 0 | 74 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val |
| | | 75 | | } |
| | | 76 | | |
| | 296 | 77 | | _sessionMode = value; |
| | 296 | 78 | | } |
| | | 79 | | } |
| | | 80 | | |
| | 1682 | 81 | | public Type CallbackContract { get; set; } |
| | | 82 | | } |
| | | 83 | | } |