0

我正在使用 Enyim 将对象存储到 Memcached 中。

但是,当将此对象从 Memcached 中拉出时,相关实体为空。使用 System.Runtime.Caching 实体加载非常好。非常感谢存储这些相关实体的任何帮助或提示。谢谢你。

[Serializable]
public class Inventory
{
    public Inventory() {  }

    public int InventoryID { get; set; }

    //Not Null
    public int ProductID { get; set; }

    //Null with Enyim
    public virtual Product Product { get; set; }

    //Null with Enyim
    public virtual ICollection<WarehouseInventory> WareHouseInventories { get; set; }

....
}
4

1 回答 1

0

您必须禁用 dbContext.Configuration.ProxyCreationEnabled,并确保在物化 Inventory 对象时加载所有聚合对象。(在 System.Data.Entity 命名空间中的 Inventory 对象上使用“包含”扩展方法)

于 2014-11-13T09:05:01.623 回答