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
.DynamicProxy
.Builder
19 using Castle
.DynamicProxy
.Builder
.CodeGenerators
;
22 /// Summary description for DefaultProxyBuilder.
25 public class DefaultProxyBuilder
: IProxyBuilder
27 ModuleScope _scope
= new ModuleScope();
29 public DefaultProxyBuilder()
33 protected ModuleScope ModuleScope
35 get { return _scope; }
38 #region IProxyBuilder Members
40 public virtual Type
CreateInterfaceProxy(Type
[] interfaces
, Type type
)
42 InterfaceProxyGenerator generator
= new InterfaceProxyGenerator(_scope
);
43 return generator
.GenerateCode(interfaces
, type
);
46 public virtual Type
CreateClassProxy(Type theClass
)
48 ClassProxyGenerator generator
= new ClassProxyGenerator(_scope
);
49 return generator
.GenerateCode(theClass
);
52 public Type
CreateClassProxy(Type theClass
, Type
[] interfaces
)
54 ClassProxyGenerator generator
= new ClassProxyGenerator(_scope
);
55 return generator
.GenerateCode(theClass
, interfaces
);
58 public virtual Type
CreateCustomInterfaceProxy(Type
[] interfaces
, Type type
, GeneratorContext context
)
60 InterfaceProxyGenerator generator
= new InterfaceProxyGenerator(_scope
, context
);
61 return generator
.GenerateCode(interfaces
, type
);
64 public virtual Type
CreateCustomClassProxy(Type theClass
, GeneratorContext context
)
66 ClassProxyGenerator generator
= new ClassProxyGenerator(_scope
, context
);
67 return generator
.GenerateCustomCode(theClass
, null);