Hi NH people,
Couple Simple NH questions,
Only just started using NH, the version I'm using is 2.0.1GA with dotnet 3.5
1. Which method do caching apply to? from the docoumentation (14.5):
"Whenever you pass an object to Save(), Update() or SaveOrUpdate() and whenever you retrieve an object using Load(), Find(), Enumerable(), or Filter()"
Does that not include result sets fetch via CreateQuery Or Using CreateCriteria?
2. What is the best way to delete a collection of entities when I have an array ints representing ids (int[])?
3. Is there a way to fetch a subset of an objects fields and still return it the object.
eg (none of the details here are real just an example),
Table TestEntity
id int
name varchar(20)
item1 varchar(20)
value2 varchar(20)
IQuery Q = UnitOfWork.CurrentSession.CreateQuery("SELECT T.Id, T.Name FROM TestEntity AS T");
Q.List<TestEntity>()
When ever I try that I recieve this error: "The value \"System.Object[]\" is not of type \"Domain.TestEntity\" and cannot be used in this generic collection.\r\nParameter name: value"
4. When I create a query such as the above in question 3, is there a way to obtain metadata about the types and column names returned from the query?
so for above query I would like to end up with:
Id, system.Int
Name, System.string
5. Whats the best way to handle entities in a disconnected WCF situation, I'm using DTO and mapping them it seems to work, just wondered if anyone had better ways to handle it (maybe using the entities natively)?
Thanks!
Maxus
|