Are you saying that you just want one row back or one integer value? If you want just one row, you can do query.UniqueResult<Voucher>().
Jon On Tue, May 26, 2009 at 11:40 AM, Nigel <[email protected]> wrote: > > I have a table with several fields, I want to supply criteria for a > couple of the fields but only want one field back. So I create a query > with a typeof Voucher but in the results I only want to get one int > field back, rather than the whole table, var results = > query.List<Voucher>(). How do I do this? > > public IEnumerable<Voucher> GetUpdatedVouchers(byte[] > startingTimestamp, int ItemId) > { > var session = GetCleanSession(); > var query = session.CreateCriteria(typeof (Voucher)); > > query.AddAndConditions() > .Property("DBTimestamp").IsGreaterThanOrEqualTo((byte > [])startingTimestamp); > query.AddAndConditions() > .Property("Itemid").Equals((int)ItemId); > > var results = query.List<Voucher>(); > > return results; > } > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" 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/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
