breeze

Exporting Importing Breeze Model and hasTempKey issues

风流意气都作罢 提交于 2019-12-06 15:40:12
问题 When you create a new entity Breeze set id:-1 state:'Added' hasTempKey:true. After export and re-import Breeze doesn't merge the import -1 entity with the current -1 entity in memory it adds a new one... this is explain in the docs... ( but how do we overcome this problem is the question in my case... ) So I tried to set the entity created to setUnchanged(); Now the export import cycle runs as expected but the created entity has lost it's hasTempKey:true property so newly created entity can

Breeze (1.4.5) unidirectional one-to-many: navigation collection not populated

懵懂的女人 提交于 2019-12-06 14:22:37
I have a model where I have a two entities, a "Parent" and a "Child". The relationship should be obvious but goes: Parent has zero or more Child entities. The Parent has a navigation property called "Children" with a collection of Child entities. The Child does NOT have a navigation property back to the parent. It only has a foreign key leading back to the parent. When I load these models into my EntityManager, the "Children" navigation property collection is only ever populated with 1 child, even though the given Parent entity in fact have several. I have tried adding a "Parent" navigation

Breeze does not replace the Ref: node with its real data

强颜欢笑 提交于 2019-12-06 13:22:24
How to force breeze to load the real Node data instead of something like Object {$ref: "5"} ? This happens all the time except for one of my extended properties that I created in my Client side code. The raw JSON has this part: CurrentUserAssignments: [ { $ref: "5" } ], which never gets referred to the node 5, which is also included in raw JSON results. Here is part of my EF Entity: public class Task { public Guid Id {get; set;} private ICollection<Assignment> _assignments; public virtual ICollection<Assignment> Assignments { get { return _assignments ?? (_assignments = new Collection

Breeze Durandal Access shell viewmodel variable from view

房东的猫 提交于 2019-12-06 13:07:53
问题 I have a pretty simple thing I want to accomplish but I cannot figure out how or if it is even possible. I am using the Hot Towel template to start with. In the shell viewmodel I have a user observable. I would like to be able to reference that user observable from other pages on my site. For example from the home page. I tried a couple of things but it doenst appear as though I can access the shell from the composed view. I have a working solution at the moment that uses event pub/sub calls

How to Return Extra Data with IQueryable method?

我怕爱的太早我们不能终老 提交于 2019-12-06 12:01:13
I am using Entity Framework and Breeze. For an Entity, there is a bit of associated data I would like to provide with the entity. Getting this data is most efficiently done by querying the Entity table and joining to other tables; this query includes a group by sub-query. I am attempting to tack this extra data on by adding it as a [NotMapped] field to the entity: [NotMapped] public string NotMappedField { get; set; } So then I basically want to replace this webapi controller method [HttpGet] public IQueryable<MyObject> MyObjects() { return _contextProvider.Context.MyObjects; } With something

Server side validation with custom EFContextProvider

最后都变了- 提交于 2019-12-06 12:00:45
问题 After reading about Custom EFContextProvider and implementing it, I am still trying to figure out what is the best way to perform server side validation and how to apply business rule before saving...Namely my questions are revolving around 2 methods that are supposed to be overridden: protected override bool BeforeSaveEntity(EntityInfo entityInfo) { //} protected override Dictionary<Type, List<EntityInfo>> BeforeSaveEntities(Dictionary<Type, List<EntityInfo>> saveMap) { // } I am aware that

breezejs: getEntityByKey with expand

北战南征 提交于 2019-12-06 11:57:28
Let's say I have a list of Product entities. Then I want to edit one of these products, so I'm going to call getEntityByKey to get it from the cache. However on the edit screen, it is likely that I'm going to display more properties than in the grid, and in my case I actually need to do an expand() on some of the Product properties. So how do I handle that regarding caching ? If I use getEntityByKey, it's not going to do the expand(). I could execute a query, but then I don't take advantage of cached entities (in case I had already edited the Product before). What strategy should I opt for in

How do I inspect change-set data on the server before saving it?

怎甘沉沦 提交于 2019-12-06 11:00:17
A friend asks "Do you have examples or docs on how to inspect the Breeze change-set data on the server and perform server side validation and security checks before committing the data to the database?" My answer follows. See the " Custom EFContextProvider " topic in the documentation which describes the Breeze.NET facilities for this purpose. Although this topic targets the EFContextProvider<T> specifically, most of the points apply to the base class, ContextProvider<T> , which is helpful when saving to any kind of data store (see the "NoDb" sample for example). The app produced by the

Breeze.js - getting error trying to use “any” operator - error: Unable to get value of the property 'isAnonymous': object is null or undefined

扶醉桌前 提交于 2019-12-06 10:29:32
I am trying to use the "any" operator in Breeze to query a many table and I am getting the following error - TypeError: Unable to get value of the property 'isAnonymous': object is null or undefined The only stackoverflow question I can find that seems related is this one, but there is no solution to the isAnonymous issue because the poster did not provide more code: breeze projection : error selecting non scalar navigation properties I am using Breeze 1.4.11 with Entity Framework 5 The query I am trying to run is var getEntities = function (entitiesObservable) { var whereClause = "";

Breeze.js with WCF Data Service

烈酒焚心 提交于 2019-12-06 07:05:44
问题 I just started exploring the js library, breeze.js. I've looked through the samples but can't seem to find any example on how to consume a WCF Data Service (all the examples seem to be on Web API). Does any one know how to consume a WCF Data Service (or any other OData service) with breeze.js? I read somewhere in the docs that breeze.js only supports reads for OData services at the moment. That is fine by me as the use-case I'm considering it for does not include writes to the OData Service.