diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2009-08-07 10:27:33 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2009-08-07 10:27:33 +0400 |
commit | 179ab148aaeba9891065a31ed1adf3f0186b7dce (patch) | |
tree | 94774ed6b5cf02776b4c88c207ba31982eedfb25 /mcs | |
parent | 265b42e1920a0876713a9f723028d80d72f0c9d6 (diff) |
2009-08-07 Atsushi Enomoto <atsushi@ximian.com>
* ContractDescriptionGenerator.cs : add new contract getter to
create callback contract type (which does not demand
ServiceContractAttribute).
svn path=/trunk/mcs/; revision=139548
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs | 20 |
2 files changed, 22 insertions, 4 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog index b5aec5220b0..060787c16c4 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog @@ -1,5 +1,11 @@ 2009-08-07 Atsushi Enomoto <atsushi@ximian.com> + * ContractDescriptionGenerator.cs : add new contract getter to + create callback contract type (which does not demand + ServiceContractAttribute). + +2009-08-07 Atsushi Enomoto <atsushi@ximian.com> + * ServiceEndpoint.cs, ContractDescription.cs : moved client runtime creator from former to latter. diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs index 6126ff6db24..20801ce2ae1 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs @@ -67,13 +67,11 @@ namespace System.ServiceModel.Description return table; } - [MonoTODO] public static ContractDescription GetContract ( Type contractType) { return GetContract (contractType, (Type) null); } - [MonoTODO] public static ContractDescription GetContract ( Type contractType, object serviceImplementation) { if (serviceImplementation == null) @@ -93,10 +91,19 @@ namespace System.ServiceModel.Description return null; } - [MonoTODO] + public static ContractDescription GetCallbackContract (Type type) + { + return GetContract (type, null, true); + } + public static ContractDescription GetContract ( Type givenContractType, Type givenServiceType) { + return GetContract (givenContractType, givenServiceType, false); + } + + static ContractDescription GetContract (Type givenContractType, Type givenServiceType, bool assumeServiceContract) + { // FIXME: serviceType should be used for specifying attributes like OperationBehavior. Type exactContractType = null; @@ -117,8 +124,13 @@ namespace System.ServiceModel.Description sca = contracts [t]; } } + if (exactContractType == null) + exactContractType = givenContractType; if (sca == null) { - throw new InvalidOperationException (String.Format ("Attempted to get contract type from '{0}' which neither is a service contract nor does it inherit service contract.", givenContractType)); + if (assumeServiceContract) + sca = new ServiceContractAttribute (); + else + throw new InvalidOperationException (String.Format ("Attempted to get contract type from '{0}' which neither is a service contract nor does it inherit service contract.", givenContractType)); } string name = sca.Name ?? exactContractType.Name; string ns = sca.Namespace ?? "http://tempuri.org/"; |