Fluent nHibernate save or update derived entity
c#, derived-class, fluent, nhibernate, save
Solution
Yes, both `ISession.Save` and `ISession.Update` have overloads that allow you to specify the entity name.
Example:
class Foo { ... }
class FooProxy : Foo { ... }
session.Save(typeof(Foo).FullName, aFooProxy);
Problem
I have an entity which data comes from the database, however, some of its properties are filled with data coming from another source (file system), so what I do is that my repository, instead of returning my entity, returns a proxy object that derives from the main entity, so the problem when I try to save or update is that it says there's no persister for that class... Is it possible to save a derived class but as the main class? My proxy object is identical to the real one except it overrides a couple of methods. Thanks! Seb :)