You must indicate the result:
OwnSession s = (OwnSession) SessionFactory.OpenSession();
If OpenSession () returns an ISession type, that could be all that ISession implements, so you should tell the compiler that you are expecting an OwnSession type (only if you are sure that it will return this, of course)
On the other hand, you can declare your variable as ISession and continue to work with it. If you do not want to use methods or properties from the OwnSession type that are not available in the ISession interface specification.
source share