Hi all,
I've been trying to use Subsonic Advanced Templates in a project for a while but most of the time I find myself writing a Stored Procedure as I can't find a proper way of doing it in code.
Subsonic created corresponding objects for my DB tables and for foreign keys it created IQueryable fields inside each object. These fields are not loaded by default and a new SQL query is executed when you access them.
1- Is there a way to get all data in one query (deep load)?
Also these fields can not be assigned. So when I want to create an object in a maintenance page, I can't put all the data into this object before saving it in DB:
Post post = new Post();
//get photos for this post
IList<PostPhoto> postPhotos = GetPostPhotos();
post.PostPhotos = postPhotos;
2- Is it possible to have one Post object with all fields set from user input?
Think of the Post object above and assume I've successfully assigned its fields. Now I need to save it to the DB.
3- Is using BatchQuery the only way to do it in one query? If I have 4 photos in PostPhotos field; 2 of them previously saved and 2 of them new, can I use the Update method to handle both the adding and updating of these photos?
Any ideas or links are appreciated.
Cheers...