breeze

Issue with inheritance with WebAPI, OData v3 and BreezeJs

你离开我真会死。 提交于 2019-12-06 07:03:18
We are using WebAPI 2.2, with OData v3 and BreezeJS and are having an issue when using inheritance, we have a setup along the following lines (simplified obviously for this issue) We have a Vehicle abstract class and then two other classes (Bus and Car) which inherit from Vehicle, such as: public abstract class Vehicle { public int Id { get; set; } public string Name { get; set; } } public class Bus : Vehicle { public int NumberOfSeats { get; set; } } public class Car : Vehicle { public string Colour { get; set; } } We then have an Activity class which can have a single Vehicle (either a Car

Breeze WebAPI: How to combine QueryResult with ODataQueryOptions to return inlineCount

故事扮演 提交于 2019-12-06 06:49:17
I tried different ways of loading a list of items using breeze and the API Controller, using filters (partly using a custom object and another part using ODataQueryOptions), but none of them turn out to be really successful. Test code in javascript: function test() { EntityQuery .from("Products") /* .withParameters({ filters: [ { column: "Name", value: "12" } ]}) */ .orderBy("Name desc") .skip(30) .take(15) .inlineCount(true) .using(manager) .execute() .then(success) .fail(fail); function success(data) { console.log(data.products); console.log(data.inlineCount); } function fail(error) {

BreezeJS: Server added object showing as added in client after save changes

不羁岁月 提交于 2019-12-06 04:24:04
I have a breeze controller that adds an entity during the save changes that the client did not submit. protected override bool BeforeSaveEntity(EntityInfo entityInfo) { if (entityInfo.Entity.GetType() == typeof(User)) { if (entityInfo.EntityState == EntityState.Added) { User user = entityInfo.Entity as User; OrganizationUser orgUser = new OrganizationUser() { Enabled = true, OrganizationId = User.OrgId, User = user }; user.OrganizationUsers.Add(orgUser); } return true; } throw new InvalidOperationException("You can not use this service to modify an entity of type: " + entityInfo.Entity.GetType

How to use Breeze with Generic Unit of Work and Repositories?

心不动则不痛 提交于 2019-12-06 03:12:58
Using this: https://genericunitofworkandrepositories.codeplex.com/ and the following set of blog posts: http://blog.longle.net/2013/05/11/genericizing-the-unit-of-work-pattern-repository-pattern-with-entity-framework-in-mvc/ We are trying to use those repositories with Breeze since it handles client side javascript and OData very well. I was wondering how we could use these with Breeze to handle overriding the BeforeSaveEntity correctly. We have quite a bit of business logic that needs to happen during the save (modifying properties like ModifiedBy , ModifiedTime , CreatedBy , etc) but when we

Missing inverse property in asp.net webapi odata $metadata

北战南征 提交于 2019-12-06 00:33:21
have very simple relationship between two entities and I am trying to expose them with asp.net webapi odata controllers but it seems that something is wrong with $metadata. When I run jaydatasvcutil.exe on the $metadata I get warning: inverseProperty other side missing. When I use breezejs loadNavigationProperty I get similar error. I have the problem even with official example. http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/working-with-entity-relations You can observe the $metadata here http://sdrv.ms/Z5Klfw Please help. When we are generating navigation properties we

Is breeze server side metadata mandatory or can it be be defined client-side?

廉价感情. 提交于 2019-12-06 00:16:03
问题 I am looking in to using breezejs and have a few questions in terms of its capabilities and the best practices that come with it. Does server side metada have to exist? If I have a non EF WebApi controller do I still have to wrap it with the ProviderContext and implement metadata? If so, what is the format of the metadata? If I am able to omit metadata on the server side and just implement the queryable actionfilter, can I still write client side code to define the metadata? Where would I

validationOptions not working with custom bindingHandlers

筅森魡賤 提交于 2019-12-05 23:39:53
问题 I'm using durandal/breeze with Knockout. I am working on validation on my inputs with ko.validation . Here is a classic: <input type="text" data-bind="value: myDate, validationOptions: { errorElementClass: 'input-validation-error'}" /> .input-validation-error { background-color: #c75b55 !important; } This one works pretty well: when validation failed, the input textbox is marked in red. Now I would like to use a bindingHandlers in place of a 'simple' value binding: <input type="text" data

Breeze - How to Load Navigation property from cache

纵饮孤独 提交于 2019-12-05 19:24:38
I am getting a single entity by using a method fetchEntityByKey , after that I am loading navigation property for the entity by entityAspect.loadNavigationProperty . But loadNavigationProperty always make a call to the server, what I am wondering if I can first check it from cache, if it is exist then get it from there otherwise go the server. How is it possible? Here is my current code return datacontext.getProjectById(projectId) .then(function (data) { vm.project = data; vm.project.entityAspect.loadNavigationProperty('messages'); }); Here is a function that I encapsulated inside datacontext

Error with breeze when deleting an entity which contains child entities

岁酱吖の 提交于 2019-12-05 18:52:59
I work on a project with Entity Framework Code First + Durandal + Breeze. I have these entities models: public class Packing { [Key] public int Id { get; set; } public string PackingDescription { get; set; } ... public virtual List<Isotope> Isotopes { get; set; } public virtual List<PhysicalForm> PhysicalForms { get; set; } public virtual List<ChemicalForm> ChemicalForms { get; set; } } public class Isotope { [Key] public int Id { get; set; } public string Name { get; set; } ... public int PackingId { get; set; } public virtual Packing Packing { get; set; } } public class ChemicalForm { [Key]

using Angular validation directives with Breeze blocks any input that is invalid

这一生的挚爱 提交于 2019-12-05 18:09:24
问题 If you add any of the angular directives for validation (ng-minlength, ng-maxlength, ng-pattern, etc.) to an input that is bound to a breeze entity it blocks any user input if found to be invalid. If the value from ng-model is initially valid it shows up, but if you change the value to something invalid the input field is cleared, the model is set to null, and you can't input anything that may be initially invalid. However if you copy a valid value into the field it shows. I would be fine