It is amazing how some of the more experienced (or those with a better idea than mine) will solve my specific simulation scenario ...
I have a typical script Category → SubCategory → TertiarySubCategory and I'm not sure if I am matching it correctly. I correlate this directly with the MVC route, since the raven seems to do a good job of this. In the last category (which may be at the first, second or third level there will be a list of elements related only to this level of the category. Thus, we may have something like:
Category of one level: '/ Politics /'
Second level category: "Politics / People" or "Politics / Websites"
Three-level category: "Sports / Pro / Volleyball" or "Sports / College / Football"
In a traditional RDBMS, this is easy through primary / foreign keys + several associations ... so, I wonder how I will deal with Raven?
From what I read, should I store the entire "URI" or "Key" in sports / pro / volleyball in the list of items that fall under it?
i.e. -
public class CategoryItem
{
public string FriendlyName {get;set;}
public string CategoryURI {get;set;}
public string content {get;set;}
public List<string> Comments {get;set;}
}
var survey1 = new CategoryItem();
survey1.CategoryURI = "/sports/pro/volleyball/"
survey1.Content = "Who is the best female pro volleyball player?";
survey1.Comments.Add(new Comment("Misty May"));
var survey2 = new CategoryItem();
survey2.CategoryURI = "/sports/pro/volleyball/";
survey2.Content = "Who is the best male pro volleyball player?";
survey2.Comments.Add(new Comment("Some guy I don't kow");
ravenSession.Store(survey1);
ravenSession.Store(survey2);
ravenSessoin.SaveChanges();
var items = session.Query<CategoryItem>()
.Where(x => x.CategoryURI == "/sports/pro/volleyball/");
Or do I need to create an item list item from an actual category class? Each element has a list of its own comments ... which means everything that is stored in one document inside Raven - i.e. -
public class Category
{
public string FriendlyName {get;set;}
public string URI {get;set;}
public List<CategoryItem> Items {get;set;}
}
public class CategoryItem
{
public string Content {get;set;}
public List<string> Comments {get;set;}
}
var vballCat = new Category();
vballCat.FriendlyName = "Pro Volleyball";
vballCat.URI = "/sports/pro/volleyball/";
var catItem = new CategoryItem().
catItem.Content = "Who is the best male pro volleyball player?";
catItem.Comments.Add("Misty May");
catItem.Comments.Add("Some Guy 1");
vballCat.Items.Add(catItem);
ravenSession.Store(vballCat);
ravenSession.SaveChanges();
..... now that I am pulling out the main cat, that is - "/ sports / pro / volleyball /" I have everything I need already under it "
var items = session.Query<Category>()
.Where(x => x.URI == "/sports/pro/volleyball/");
{............. etc................}
Items .... ? , ? , !?!?
, . , / ... , . !