You could add a boolean property to your entity, say WasCreatedByNHibernate, and set this to true in a Save Event Listener.
Ian Ian Nelson +44 7901 828483 http://ianfnelson.com http://iannelsonsystems.com On Tue, Oct 5, 2010 at 18:39, Mauricio Scheffer <[email protected]>wrote: > You could try ISession.Contains(), but I would have separate classes for NH > and SP-managed stuff instead. IMHO having these things together will be > quite tricky to get right and will probably get ugly sooner or later. > > On Tue, Oct 5, 2010 at 1:24 PM, chitech <[email protected]> wrote: > >> We have entities that can be populated from stored proceduces (legacy >> system) and NH. Some of the properties on these entities is only >> populated by stored procedures (the logic is placed in SP) and these >> will then be null if NHibernate created them >> >> You are right that the object should not be aware if the SP or NH >> create them. But to be backward compatible with existing SP we need in >> some cases to know if the object is created by NH >> >> On 5 Okt., 14:26, Krzysztof Koźmic <[email protected]> wrote: >> > Why would you want that? In general you would KNOW that because the >> > structure of your code would make it unambigous. >> > >> > What's your actual scenario?? >> > >> > On 5/10/2010 9:34 PM, chitech wrote: >> > >> > >> > >> > > Alo >> > >> > > Can I somehow check if an object is created by ActiveRecord/ >> > > NHibernate? >> > >> > > I know that NHibernate Identity map keeps track on all Nhibernate >> > > objects within a SessionScope. Can I get the information from the >> > > current SessionScope or query the map to get the answer? >> > >> > > Thx in advance >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Castle Project Users" group. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<castle-project-users%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/castle-project-users?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected]<castle-project-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/group/castle-project-users?hl=en.
