1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.Facilities
.WcfIntegration
18 using System
.Collections
.Generic
;
20 public class WcfServiceModel
: IWcfServiceModel
23 private ICollection
<Uri
> baseAddresses
;
24 private ICollection
<IWcfEndpoint
> endpoints
;
25 private ICollection
<IWcfBehavior
> behaviors
;
27 #region IWcfServiceModel
31 get { return hosted; }
34 public ICollection
<Uri
> BaseAddresses
38 if (baseAddresses
== null)
40 baseAddresses
= new List
<Uri
>();
44 set { baseAddresses = value; }
47 public ICollection
<IWcfEndpoint
> Endpoints
51 if (endpoints
== null)
53 endpoints
= new List
<IWcfEndpoint
>();
57 set { endpoints = value; }
60 public ICollection
<IWcfBehavior
> Behaviors
64 if (behaviors
== null)
66 behaviors
= new List
<IWcfBehavior
>();
74 public WcfServiceModel
Hosted()
80 public WcfServiceModel
AddBaseAddresses(params Uri
[] baseAddresses
)
82 foreach (Uri baseAddress
in baseAddresses
)
84 BaseAddresses
.Add(baseAddress
);
89 public WcfServiceModel
AddBaseAddresses(params string[] baseAddresses
)
91 foreach (string baseAddress
in baseAddresses
)
93 BaseAddresses
.Add(new Uri(baseAddress
, UriKind
.Absolute
));
99 public WcfServiceModel
AddEndpoints(params IWcfEndpoint
[] endpoints
)
101 foreach (IWcfEndpoint endpoint
in endpoints
)
103 Endpoints
.Add(endpoint
);
108 public WcfServiceModel
AddBehaviors(params object[] behaviors
)
110 foreach (object behavior
in behaviors
)
112 Behaviors
.Add(WcfExplcitBehavior
.CreateFrom(behavior
));