Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/ServiceModel
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29391
Modified Files:
ServiceExporter.cs
Log Message:
Minor update of the WCF service exporter.
Index: ServiceExporter.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/ServiceModel/ServiceExporter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ServiceExporter.cs 18 May 2007 21:04:37 -0000 1.1
--- ServiceExporter.cs 21 Sep 2007 14:26:26 -0000 1.2
***************
*** 23,29 ****
--- 23,31 ----
using System;
+ using System.Collections;
using Spring.Util;
using Spring.Context;
+ using Spring.Core.TypeResolution;
using Spring.Objects;
using Spring.Objects.Factory;
***************
*** 31,34 ****
--- 33,37 ----
using Spring.ServiceModel.Support;
using Spring.Context.Support;
+ using Spring.Proxy;
#endregion
***************
*** 52,55 ****
--- 55,61 ----
private string targetName;
+ private string[] _contracts;
+ private IList _typeAttributes = new ArrayList();
+ private IDictionary _memberAttributes = new Hashtable();
private IApplicationContext applicationContext;
***************
*** 82,85 ****
--- 88,130 ----
}
+ /// <summary>
+ /// Gets or sets the list of service contracts.
+ /// </summary>
+ /// <remarks>
+ /// If not set, all the interfaces implemented or inherited
+ /// by the target type will be used.
+ /// </remarks>
+ /// <value>The interfaces.</value>
+ public string[] Contracts
+ {
+ get { return _contracts; }
+ set { _contracts = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets a list of custom attributes
+ /// that should be applied to the WCF service class.
+ /// </summary>
+ public IList TypeAttributes
+ {
+ get { return _typeAttributes; }
+ set { _typeAttributes = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets a dictionary of custom attributes
+ /// that should be applied to the WCF service members.
+ /// </summary>
+ /// <remarks>
+ /// Dictionary key is an expression that members can be matched against.
+ /// Value is a list of attributes that should be applied
+ /// to each member that matches expression.
+ /// </remarks>
+ public IDictionary MemberAttributes
+ {
+ get { return _memberAttributes; }
+ set { _memberAttributes = value; }
+ }
+
#endregion
***************
*** 149,153 ****
string contextName = (applicationContext.Name == AbstractApplicationContext.DefaultRootContextName) ? null : applicationContext.Name;
Type targetType = objectFactory.GetType(targetName);
! Type serviceType = new ServiceProxyTypeBuilder(contextName, targetName, targetType).BuildProxyType();
serviceHost = new System.ServiceModel.ServiceHost(serviceType);
--- 194,206 ----
string contextName = (applicationContext.Name == AbstractApplicationContext.DefaultRootContextName) ? null : applicationContext.Name;
Type targetType = objectFactory.GetType(targetName);
! IProxyTypeBuilder builder = new ServiceProxyTypeBuilder(contextName, targetName, targetType);
! if (Contracts != null && Contracts.Length > 0)
! {
! builder.Interfaces = TypeResolutionUtils.ResolveInterfaceArray(Contracts);
! }
! builder.TypeAttributes = TypeAttributes;
! builder.MemberAttributes = MemberAttributes;
!
! Type serviceType = builder.BuildProxyType();
serviceHost = new System.ServiceModel.ServiceHost(serviceType);
|