What type of relationships are these?
I'm new to nhibernate and i haven't dealt with databases in a long time.
My recipe object:
public class Recipe
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual IList<Category> Category { get; set; }
public virtual int CookTime { get; set; }//in minutes
public virtual int OvenTemp { get; set; }// in farenhieht
public virtual IList<Ingredient> Ingredients { get; set; }
public virtual string Instructions { get; set; }
}
my Category object:
public class Category
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
}
my Ingredient object:
public class Ingredient
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual float Amount { get; set; }
public virtual UnitName Unit { get; set; }
}
and my UnitName object:
public class UnitName
{
publi开发者_如何转开发c virtual string ShortName { get; set; }
public virtual string LongName { get; set; }
}
so my question is what type of relationship is there between recipe and Category/Ingredient? and between Ingredient and UnitName?
I've read the descriptions of the various types of relationships, but they all seem wrong for some reason. I know thats not true so there is something i'm not getting.
It's a many-to-many relationship: Each recipe has many ingredients / categories, and each category/ingredient has/is in many recipes.
精彩评论