IMO you are putting something in an entity, as property, that should be in another place. "object loaded by a black box provider implementing an interface"... for example a remote-external-service and you want access to it with a simple property ? A many-to-one with a IUserType ?
"while allowing batch loading of the Authors"... where is the collection ? Batch loading is possible with entities and not with IUserType. Implementing IUserType you can do many things but, the UserType was thought as a "special-component" in general use to transform one or more db-columns in a property. Perhaps you are finding the solution in the wrong place (I mean something outside NH scope). If you want solve it through a property a DynamicProxy, to smart-load info from the black-box, would be the solution and NH shouldn't know the existence of that property. mmm I have too many questions... perhaps is the reason because I can't find an answer. 2010/4/2 Dan Sell <[email protected]> > It's not a database that I necessarily have access to (actually maybe > it isn't a database at all, basically an object loaded by a black box > provider implementing an interface) > > I'll try to explain better with some back of the napkin code, so > excuse me if there are errors in it :) > > <class name="Comment"> > <id name="Id"> > </id> > <many-to-one name="Author" type="ProviderUser" /> > ... > </class> > > Imagine now we have a provider interface: > > public interface IUserProvider > { > User GetUser(string userId); > User[] GetUsers(string[] userIds); > } > > Then ProviderUser is something like: > > public class ProviderUser : NHibernate.UserTypes.IUserType > { > ... > public object NullSafeGet(System.Data.IDataReader rs, string[] names, > object owner) > { > string uid = > NHibernate.NHibernateUtil.String.NullSafeGet(rs, names[0]) as string; > IUserProvider userProvider = > BadStaticClass.GetUserProvider(); > > return userProvider.GetUser(uid); > } > ... > } > > My question is how can I implement something like this while allowing > batch loading of the Authors. Sorry for my poor description before. > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
