1 // Copyright 2004-2007 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
.ActiveRecordIntegration
18 using System
.Collections
;
23 using NHibernate
.Connection
;
24 using NHibernate
.Dialect
;
25 using NHibernate
.Engine
;
26 using NHibernate
.Metadata
;
28 using Castle
.ActiveRecord
.Framework
;
31 /// Implements <see cref="ISessionFactory"/> allowing
32 /// it to be used by the container as an ordinary component.
33 /// However only <see cref="ISessionFactory.OpenSession(IDbConnection)"/>
36 public sealed class SessionFactoryDelegate
: ISessionFactory
38 private readonly Type arRootType
;
39 private readonly ISessionFactoryHolder holder
;
41 public SessionFactoryDelegate(ISessionFactoryHolder holder
, Type arRootType
)
43 this.arRootType
= arRootType
;
47 public ISession
OpenSession(IDbConnection conn
)
49 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
52 public ISession
OpenSession(IInterceptor interceptor
)
54 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
57 public ISession
OpenSession(IDbConnection conn
, IInterceptor interceptor
)
59 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
62 public ISession
OpenSession()
64 ISession realSession
= holder
.CreateSession( arRootType
);
66 return new SafeSessionProxy(holder
, realSession
);
69 public IDatabinder
OpenDatabinder()
71 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
74 public IClassMetadata
GetClassMetadata(Type persistentType
)
76 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
79 public ICollectionMetadata
GetCollectionMetadata(string roleName
)
81 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
84 public IDictionary
GetAllClassMetadata()
86 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
89 public IDictionary
GetAllCollectionMetadata()
91 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
94 /// <remarks>Needed for NHibernate 1.2 from trunk</remarks>
95 public ISession
GetCurrentSession()
97 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
102 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
105 public void Evict(Type persistentClass
)
107 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
110 public void Evict(Type persistentClass
, object id
)
112 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
115 public void EvictCollection(string roleName
)
117 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
120 public void EvictCollection(string roleName
, object id
)
122 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
125 public void EvictQueries()
127 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
130 public void EvictQueries(string cacheRegion
)
132 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
135 public FilterDefinition
GetFilterDefinition(string filterName
)
137 throw new NotImplementedException("SessionFactoryDelegate: not implemented");
140 public IConnectionProvider ConnectionProvider
142 get { throw new NotImplementedException("SessionFactoryDelegate: not implemented"); }
145 public Dialect Dialect
147 get { throw new NotImplementedException("SessionFactoryDelegate: not implemented"); }
150 public ICollection DefinedFilterNames
152 get { throw new NotImplementedException("SessionFactoryDelegate: not implemented"); }
155 public Settings Settings
157 get { throw new NotImplementedException("SessionFactoryDelegate: not implemented"); }
160 public IDictionary Items
162 get { throw new NotImplementedException(); }
165 public void Dispose()