Relations and lazy downloads in SubSonic 3.0

I am currently playing with SubSonic 3.0, and it looks very straightforward (except that I still have to choose between SimpleRepository and ActiveRecord, but that's a different story).

However, since the documentation is a bit sparse, I'm not sure if it supports external relationships and lazy loading. Essentially, I have a class publication:

public class Posting { [SubSonicPrimaryKey] public Guid InternalId { get; set; } public string Title { get; set; } public string Body { get; set; } public DateTime? PostingDate { get; set; } public List<Comment> Comments { get; set; } } 

and class Comment:

 public class Comment { public string Body { get; set; } } 

As you can see, Posting has a list of comments. Can I somehow tell SubSonic that the two are connected? Does this mean that I can automatically save all comments when saving a message? And more importantly, when I download the posting, I would first like the comments list to be empty, and at some point say, “Okay, please fill it out now.”

I know that I can manually manage this in Code, but I just wanted to know if SubSonic can do this before I start the manual work.

+6
orm subsonic subsonic3
source share
2 answers

sparse? Have you read them yet?

ActiveRecord can define your relationships based on FK (you can also use Linq templates) and will use IQueryable. Thus, you get the best of both worlds - they are there if you need them.

If you use Simple Repo - no - this does not happen, and this is all a guide.

+4
source share

There is an easy way to manage foreign keys, even if you use Simple Repo. This post is for details.

+3
source share

All Articles