我將存儲產品可用的課程ID的逗號分隔列表,其中可能有任意數量的它們,並且多次只有一個。我正在使用MVC,我希望能夠在列表模型之前將列表提取出來。基本上我不想將一個列表解析到視圖或控制器內部的數組中......如何/在哪裏執行此操作的最佳方式,這裏是我的存儲庫使用的產品對象。我將使用什麼類型的courseIDs集合,以及將數據庫中逗號分隔列表中的數據轉換爲數組或類似內容?如何使未定義的集合成爲我的對象的一部分?
namespace DomainModel.Entities
{
public class Product
{
public int ProductID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public ??? CourseIDs { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DomainModel.Entities;
namespace DomainModel.Abstract
{
public interface IProductsRepository
{
IQueryable<Product> Products { get; }
}
}
我正在使用LINQ to SQL – BigOmega 2009-08-26 17:27:04