简体   繁体   English

将微风谓词应用于可观察数组中的数据

[英]Apply breeze predicate to data in an observable array

I am executing breeze queries for my entities and storing the data in browser local cache. 我正在为我的实体执行微风查询,并将数据存储在浏览器本地缓存中。 If I happen to load these entities in future, instead of executing the breeze query again I am loading the data from local storage into observable arrays. 如果将来碰巧要加载这些实体,而不是再次执行微风查询,而是将数据从本地存储加载到可观察的数组中。 I was wondering how can I filter data in these observable arrays by applying breeze predicates since I won't be executing breeze queries again. 我想知道如何通过应用微风谓词来过滤这些可观察数组中的数据,因为我将不再执行微风查询。

Is it possible to apply breeze predicates on an observable array to filter data ? 是否可以在可观察数组上应用微风谓词来过滤数据?

Breeze has the ability to execute your query locally . Breeze能够在本地执行查询 For this to work you'll need to load the data from local storage into a breeze entity manager. 为此,您需要将本地存储中的数据加载到轻巧的实体管理器中。 There are several ways to do this ( importEntities , attachEntity ), the approach depends on how you are storing and retrieving your entities from local storage. 有几种方法可以做到这一点( importEntitiesattachEntity ),该方法取决于您如何存储和从本地存储中检索实体。 It would make your life easier if you used exportEntities and importEntities when storing/retrieving entity data from local storage. 如果从本地存储中存储/检索实体数据时使用了exportEntitiesimportEntities ,将使您的生活更加轻松。 If you do choose to use exportEntites, pay careful attention to the includeMetadata argument. 如果确实选择使用exportEntites,请特别注意includeMetadata参数。 You may want to cache the metadata separately to save space. 您可能需要单独缓存元数据以节省空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM