Search Posts

Breeze with Angular entityManagerfactory

I am trying to create the entityManagerFactory for Breeze with Angular. I used HotTowel to get started on my project but when I try to get the new factory set I am getting an error from the breeze.debug.js module. It is falling into there because it appears that it expects the type of the property to match the name of the property. I’m not sure that I understand what is going on here. Can anyone point me in the right direction?
Calling code in datacontext.js:

        function getProjects() {
        return breeze.EntityQuery.from('Projects')
            .using(manager)
            .execute()
            .then(success)
            .catch(fail)
    };

Factory service:

(function() {
'use strict';

var serviceId = 'entityManagerFactory';
angular.module('app').factory(serviceId, ['breeze', emFactory]);

function emFactory(breeze) {
    // Convert server-side PascalCase to client-side camelCase property names
    breeze.NamingConvention.camelCase.setAsDefault();
    // Do not validate when we attach a newly created entity to an EntityManager.
    // We could also set this per entityManager
    new breeze.ValidationOptions({ validateOnAttach: false }).setAsDefault();

    var serviceRoot = "http://localhost:51362/";
    var serviceName = serviceRoot + 'breeze/ProjectTracking';

    var manager = new breeze.EntityManager(serviceName);
    var factory = {
        newManager: manager,
        serviceName: serviceName
    };

    return factory;        
}

})();

Offending code in breeze.debug.js:

function processUsing(eq, map, value, propertyName) {
var typeName = value._$typeName || (value.parentEnum && value.parentEnum.name);
var key = typeName && typeName.substr(0, 1).toLowerCase() + typeName.substr(1);
if (propertyName && key != propertyName) {
  throw new Error("Invalid value for property: " + propertyName);
}

Packages:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
  <package id="AngularJS.Animate" version="1.2.22" targetFramework="net461" />
  <package id="AngularJS.Core" version="1.2.22" targetFramework="net461" />
  <package id="AngularJS.Route" version="1.2.22" targetFramework="net461" />
  <package id="AngularJS.Sanitize" version="1.2.22" targetFramework="net461" />
  <package id="Antlr" version="3.4.1.9004" targetFramework="net461" />
  <package id="bootstrap" version="3.1.1" targetFramework="net461" />
  <package id="Breeze.Angular" version="1.0.0" targetFramework="net461" />
  <package id="Breeze.Angular.Directives" version="1.3.10" targetFramework="net461" />
  <package id="Breeze.Client" version="1.5.3" targetFramework="net461" />
  <package id="Breeze.Server.ContextProvider" version="1.5.0" targetFramework="net461" />
  <package id="Breeze.Server.WebApi2" version="1.5.0" targetFramework="net461" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net461" />
  <package id="FontAwesome" version="4.1.0" targetFramework="net461" />
  <package id="HotTowel.Angular" version="2.3.3" targetFramework="net461" />
  <package id="HotTowel.Angular.Breeze" version="2.3.3" targetFramework="net461" />
  <package id="jQuery" version="2.1.1" targetFramework="net461" />
  <package id="Knockout.Validation" version="1.0.1" targetFramework="net461" />
  <package id="knockoutjs" version="2.3.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net461" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net461" />
  <package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net461" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.HelpPage" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.OData" version="5.2.2" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net461" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.5" targetFramework="net461" />
  <package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net461" />
  <package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net461" />
  <package id="Microsoft.Net.Compilers" version="2.1.0" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.Owin" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net461" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
  <package id="Modernizr" version="2.6.2" targetFramework="net461" />
  <package id="Moment.js" version="2.6.0" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net461" />
  <package id="Owin" version="1.0" targetFramework="net461" />
  <package id="Q" version="0.8.12" targetFramework="net461" />
  <package id="Respond" version="1.2.0" targetFramework="net461" />
  <package id="Sammy.js" version="0.7.4" targetFramework="net461" />
  <package id="Spin.js" version="2.0" targetFramework="net461" />
  <package id="System.Spatial" version="5.6.0" targetFramework="net461" />
  <package id="toastr" version="2.0.3" targetFramework="net461" />
  <package id="WebActivator" version="1.0.0.0" targetFramework="net461" />
  <package id="WebGrease" version="1.5.2" targetFramework="net461" />
    </packages>

Error:

Error

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *