Hi,
I'm testing out NHibernate.Shards.
ShardedSessionFactoryImpl has a property SessionFactories at line 323.
public IList<ISessionFactory> SessionFactories
{
get { return new ReadOnlyCollection<ISessionFactory>
((IList<ISessionFactory>) this.sessionFactories);
}
The problem with this code is the cast to IList<SessionFactory>
because this.sessionFactories is of type
IList<ISessionFactoryImplementor>.
If you try referencing ShardedSessionFactory.SessionFactories, you
will get an exception:
----------------------
System.InvalidCastException: Unable to cast object of type
'System.Collections.Generic.List`1
[NHibernate.Engine.ISessionFactoryImplementor]' to type
'System.Collections.Generic.IList`1[NHibernate.ISessionFactory]'.
at
NHibernate.Shards.Session.ShardedSessionFactoryImpl.get_SessionFactories
() in C:\Programming\Projects\Testing\Shards\NHibernate.Shards\src
\NHibernate.Shards\Session\ShardedSessionFactoryImpl.cs: line 325
------------------------
HTH:
http://stackoverflow.com/questions/1266014/c-casting-a-listobjbase-as-listobj
As a quick fix, I used Linq to fix this issue by using:
public IList<ISessionFactory> SessionFactories
{
get { return new ReadOnlyCollection<ISessionFactory>
((this.sessionFactories.Cast<ISessionFactory>().ToList())); }
}
I can make patch if needed.
Thanks,
Brian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"NHibernate Contrib - Development Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com.ar/group/nhcdevs?hl=en
-~----------~----~----~----~------~----~------~--~---