LINQ一点点多对多关系架构建议吗? [英] A little LINQ Many-to-many relationship architecture advice please?
本文介绍了LINQ一点点多对多关系架构建议吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我觉得我最近好像在圈子里跑来跑去,现在我希望有人可以向我提供任何建议:)我正在使用ASP.NET MVC和LINQ to SQL开发一个网站,我想知道构造事物的最佳方法.
I feel as though i have been running around in circles recently, and i would like any advice that anyone can offer me at this point :) I am developing a website using ASP.NET MVC and LINQ to SQL, and i would like to know the best way to structure things.
我需要准备一些文章,每篇文章都属于一个主要"主题.类别,但也与其他几个次要"类别相关联类别的.
I need to have articles, with each article belonging to a "Main" Category, but also associated with several other "Secondary" Category's.
我的第一个设计是这样的:
My first design was along the lines of:
{ |
public Guid ID {get;放; } |
public string Name {{get;放; } |
IList < 文章 > 文章{得到;放; } |
... |
} |
公共类文章 |
{ |
public Guid ID {get;放; } |
public stringTitle {get;放; } |
public public CategoryMainCategory {get;放; } |
公众IList类别{get;放; } |
... |
} |
public class Category |
{ |
public Guid Id { get; set; } |
public string Name { get; set; } |
public IList<Article> Articles { get; set; } |
... |
} |
public class Article |
{ |
public Guid Id { get; set; } |
public string Title { get; set; } |
public Category MainCategory { get; set; } |
public IList Categorys { get; set; } |
... |
} |
推荐答案
你好Minusone,
Hello Minusone,
这篇关于LINQ一点点多对多关系架构建议吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文