0

我正在使用 LLBLGen 5.0 和 EntityCollectionBase.GetMulti(filter, relation) 来检索 oracle 数据库中的对象。

ObjectCollection objects = new ObjectCollection ();
RelationCollection relationsToUse = new RelationCollection();
relationsToUse.Add(ObjectEntity.Relations.Object2EntityUsingObject2Id);
IPredicateExpression filter = new PredicateExpression(ObjectFields.Code == sectionCode);
objects.GetMulti(filter, relationsToUse);

我想添加缓存系统以避免在数据库中多次请求。我在 LLBLGen 文档中看到,可以通过以下代码在 LLBLGen 上使用缓存:

var customers = new EntityCollection<CustomerEntity>();
using(var adapter = new DataAccessAdapter())
{
    var parameters = new QueryParameters()
    {
        CollectionToFetch = customers,
        FilterToUse = CustomerFields.Country=="USA", 
        CacheResultset = true,
        CacheDuration = new TimeSpan(0, 0, 10)  // cache for 10 seconds
    };
    adapter.FetchEntityCollection(parameters);
}

但我找不到类 DataAccessAdapter ..

你有什么想法,建议来解决我的问题吗?

提前致谢,

4

1 回答 1

0

如果您创建了一个使用 SelfServicing 的 llblgen 项目,则没有 DataAccessAdapter,因此必须使用 Adapter 选项创建项目。

如果是这样,那么它应该在 xxxx.DatabaseSpecific

其中 xxxx 是您的项目名称。

于 2018-03-05T14:41:07.960 回答