breeze

is there an easy way to mark an entity in the cache as “added”?

早过忘川 提交于 2019-12-13 04:24:14
问题 i would like to set an entity sent from the server to "added". it looks like entityaspect has methods setdeleted, setmodified, etc... but i can't seem to find one called setadded... what is the cleanest way to set an entity to "added"? i was thinking perhaps i would need to detach and then attach as "added". i have a server method called "newdeal" which creates a new entity ready for data entry... this method has business logic which i would prefer to keep on the server... when it gets to the

breezejs: inlineCount when using FetchStrategy.FromLocalCache

那年仲夏 提交于 2019-12-13 04:24:03
问题 Would it make sense to add inlineCount to the resultset when the data comes from the cache instead of the server ? I store the count locally, so as long as don't leave the current url (I use angularjs), I can get it from a variable in my controller. But once I've left that url, if I go back to it, the data will still come from the cache, but my local variable is reset to initial value. 回答1: Update 12 March 2015 The requisite changes have been committed and should make the next release (after

create new entity with new entity type in breeze

喜欢而已 提交于 2019-12-13 04:23:48
问题 I'm writing cordova + angular + breeze app where text info from element should be stored in the cash of browser that wraps the app. Accordind to the docs to do so, first I need to create new entity type in breeze. I do the following: var entityManager = new breeze.EntityManager("api/Northwind"); var newType = new breeze.EntityType({ shortName: "input" }); Next I'm trying to create new entity of this type: var newEntity = newType.createEntity(); This fails with message: "TypeError: Cannot read

Why is my KO bindings need parentheses?

谁说我不能喝 提交于 2019-12-13 04:23:13
问题 I'm developing a website using Durandal/Knockout/Breeze/WebApi with MVC4 as the back end. I'm querying my api via breeze like so: var getCategories = function() { var query = entityQuery .from('Categories') .orderBy('Order'); return manager.executeQuery(query); }; Then, on my view model: function initCategories() { service.getCategories() .then(querySuccess) .fail(queryFail); function querySuccess(data) { vm.categories(data.results); }; where vm is my bounded view model and categories is of

how to secure add or delete entities with breezejs

扶醉桌前 提交于 2019-12-13 02:59:25
问题 how can I secure SaveChanges after I added or deleted an entity to breezejs? var newTodo = todoType.createEntity(initialValues); manager.addEntity(newTodo); I want only to add/delete entities to a logged in user. Other users shouldn't be able to add an entity to another user via javascript hack. Querying only allowed entites is possible via editing EFContextProvider on the server. But how does it work with delete or add? 回答1: You can Prevent save Change on server side using overriding

breezejs fetching metadata when creating a new Entity

放肆的年华 提交于 2019-12-13 02:54:38
问题 When I call the following code: function createMandat (initialValues) { return manager.createEntity('Mandate'); } It fails because the type 'Mandate' is unknown. That I understand because I haven't yet fetched any entities of that type when I call this function. So my question is, in case the metadataStore has no knowledge of a type, how can I force a round-trip to the server in order to get metadata for this type ? What is the best place in my code for doing so ? 回答1: You can call manager

BreezeJs Navigation Property Count

北战南征 提交于 2019-12-13 02:35:46
问题 I've just started to use BreezeJS and think it is superb. It's saved me so much backend 'plumbing' code which was why I investigated it in the first place. One of the things I would like to be able to do is display a list of some accounts and a count of their contacts. At the moment I am using the code below, the Contacts field is a navigation property in EF6. The issue with this code is that I am downloading all of the contacts for each account (thousands of them) when really all I need is

Breeze returns navigation properties in the metadata, but not on the entities

怎甘沉沦 提交于 2019-12-13 02:25:21
问题 This question has been completely edited to actually outline the root issue after further investigation. I was having trouble with no navigation properties appearing on my client side metadata. With deeper inspection of the breeze client side code, I've worked out that the following code in parseCsdlNavProperty (line 6181) is causing all my collection navigation properties to be ignored: var constraint = association.referentialConstraint; if (!constraint) { // TODO: Revisit this later - right

Breeze does not expand a navigation property

依然范特西╮ 提交于 2019-12-13 00:56:55
问题 I have a Breeze dataservice (aka datacontext) in my Single Page Application. I want to get a list of Runs from a WebAPI controller along with a list of OutlineItems for each run. The controller is returning the list of open Runs with child OutlineItems with this method on the BreezeController. [AcceptVerbs("GET")] public IQueryable<Run> Runs() { return _contextProvider.Context.Runs .Include("RunOutlineItems") .AsQueryable() .Where(r => r.RunStatusId < 4); // 4 is the cutoff for open items }

How to calculate a total in a grid with breeze.js extended entities?

旧街凉风 提交于 2019-12-13 00:54:57
问题 I am working on an MVC web application using the MVVM pattern, breeze.js and knockout.js. This is the first time I use these js libraries and I still have to grasp how they work. One of the pages of the application has a grid where both columns and rows are generated dynamically. I need to add an additional column where for each row I have the total of values displayed in the following row cells. Here an example: Data type | Comment | Fact 1 | Fact 2 | Total | Value 1 | Value 2 | Value 3 |