【发布时间】:2014-01-09 01:09:16
【问题描述】:
我有两个不同的数据库,在某些列中具有相同的属性。 我的存储库的目标是获取这些属性并进行比较。
所以我是这样做的:
public sealed class Product
{
public string BarCode{ get; set; }
public string CreationDate{ get; set; }
public string Modifier{ get; set; }
public string Status { get; set; }
}
public IEnumerable<Product> GetProductsDB1()
{
// ADO.NET stuff using DataReader returning a Product List from DB1
}
public IEnumerable<Product> GetProductsDB2()
{
// ADO.NET stuff using DataReader returning a Product List from DB2
}
public IEnumerable<Product> Compare()
{
var db2 = GetProductsDB2()
var db1 = GetProductsDB1()
//Comparing both lists here and returning the result list to display in GridView
}
我不确定这是否是最好的方法。我想有任何建议使用正确的概念来做到这一点。因为这种比较很痛苦,而且我有 30 多个对象来比较做同样的事情。
谢谢。
【问题讨论】:
标签: c# oop design-patterns ado.net