我已經從NuGet安裝了最新的嵌入式二進制文件,並使用此代碼來存儲'產品'poco。過了一會兒,該進程就會因OutOfMemoryException而死亡。是否將這些數據存儲在Raven的範圍之外?如何向RavenDB添加幾百萬個文檔 - 嵌入式
謝謝。 斯蒂芬
var store = new EmbeddableDocumentStore { DataDirectory = @"C:\temp\ravendata", UseEmbeddedHttpServer = true };
store.Initialize();
using (var session = store.OpenSession())
{
foreach (var item in Parsers.GetProducts().ToList())
{
session.Store(item);
}
session.SaveChanges();
//var rdbList = session.Query<Product>().ToList();
}
[Serializable]
public class Product
{
public decimal ProductId { get; set; }
public string ItemNum { get; set; }
public string ProductName { get; set; }
public string BrandName { get; set; }
public string UOM { get; set; }
public string AveWeight { get; set; }
public string CasePack { get; set; }
public string PackageRemarks { get; set; }
public decimal Price { get; set; }
public string SupplierName { get; set; }
public string Url { get; set; }
public bool IsSpecialOrderItem { get; set; }
public bool IsSpecialPriceItem { get; set; }
public bool IsRebateItem { get; set; }
public bool IsTieredPricingItem { get; set; }
public bool IsOfflineSupplierItem { get; set; }
public string Catalog { get; set; }
public decimal CatalogId { get; set; }
public decimal CategoryId { get; set; }
public decimal PriceGroupId { get; set; }
public decimal OffineSupplierId { get; set; }
public string ManufactureName { get; set; }
public string ManufactureNum { get; set; }
public string Upc { get; set; }
public string Info { get; set; }
public string INFO2 { get; set; }
}
亞當,沒有批次..這可能是一個問題..我會在文檔中查找批次..謝謝。 – 2012-03-22 22:47:04
亞當,你和丹尼爾一樣正確(雖然有點冗長),所以我給你一個正確的答案。我能夠從Demis ServiceStack測試代碼中獲取代碼https://github.com/ServiceStack/ServiceStack.Benchmarks/blob/master/src/NoSqlPerformance/NoSqlPerformance.ConsoleApp/Program.cs – 2012-03-23 01:37:31