Common base type for ISession and IStatelessSession
Description
Environment
is duplicated by
is related to
Activity

Ricardo Peres August 22, 2014 at 1:59 PM
BTW, I noticed IStatelessSession has several method overloads missing, which really have nothing to do with missing functionality from ISession, like Get(Type, Object), for example.

Ricardo Peres August 22, 2014 at 1:49 PM
But I think the problem will only occur if we have explicit member implementations, which we don't currently have. And it is not likely that someone (famous last words) has created their own implementations of ISession and IStatelessSession with explicit member implementations.
Anyway, I have a pull request, maybe for NH 5.0: https://github.com/nhibernate/nhibernate-core/pull/308

Oskar Berggren August 20, 2014 at 8:31 PM
According to http://stackoverflow.com/a/1522698/1141275 we cannot move a method declaration to a new base interface while maintaining full API compatibility. We should be able to have the new interface and implement it in the session implementations, but we cannot touch the existing interfaces until the next major NH API break version.

Ricardo Peres August 20, 2014 at 8:29 PM
I can provide a pull request. Not all the methods apply, though (eg., getTenantIdentifier).
I don't think there will be any issues, it's just a base interface, doesn't add anything new.

Oskar Berggren August 20, 2014 at 8:18 PM
Hibernate added this in their 4.0.0 apparently, HHH-6053, hibernate-core commit 98877a3b280279ce835d79deb51549652de08317, in 2011.
They picked the name "SharedSessionContract" which I don't like, but since it's there it's probably best to use the same name in .Net (with the I prefix of course).
What are the .Net API compatibility rules regarding adding a base interface provided that no new methods are added?
Pull request with a port of the Hibernate change would be welcome, but the API compatibility question needs to be resoved.
Is there any reason why there isn't a ISessionBase or similar? Would for example be nice to write queries that's not bound to the specific type ISession or IStatelessSession at compile time but works with both of them.
Of course I can send a patch for this but wanted to check first... I guess this is nothing that will be checked in? You want to follow Hibernate API I guess?