Search code examples
entity-frameworkbackbone.jsasp.net-web-apijaydatabreeze

Entity Framework + Java Script Client


I'm trying to develop an application with a following layers:

  1. Entity Framework Model
  2. Data Service (either WCF or Web API, but I prefer Web API)
  3. Java Script + HTML + CSS Client

The model contains inheritance and polymorphic collections:

public class Master
{
    public virtual ICollection<BaseDetail> Details { get; set; }
}

public abstract class BaseDetail
{
    public virtual Master Master { get; set; }
}

public class Detail1 : BaseDetail { }
public class Detail2 : BaseDetail { }
public class Detail3 : BaseDetail { }

The problem is that I couldn't find a Java Script framework suitable for my needs:

  1. Knockback
    • pros:
      • supports inheritance and polymorphic collections very well
      • supports Web API & JSON (I think it's simpler than WCF & oData)
    • cons:
      • doesn't support EF metadata. You have to duplicate a model in java script by hands
      • doesn't understand JSON-serialized EF-model well enough. You have to pre-, post-process JSON
  2. Breeze.js
    • pros:
      • supports EF metadata very well. JS model is generated on the fly
    • cons:
      • doesn't support inheritance
      • doesn't support WebAPI + JSON
  3. JayData
    • pros:
      • supports EF metadata well enough
    • cons:
      • it seems that it supports inheritance, but doesn't support polymorphic collections
      • doesn't support WebAPI + JSON

Are there any other alternative JS-frameworks? Or maybe I'm wrong about named frameworks? Can you provide an example? Thanks!


Solution

  • Edit: As of v 1.3.1 Breeze now DOES support inheritance.

    --

    With respect to Breeze, you are correct that it does not (yet) support inheritance. That is on the Breeze road map and you might want to vote it up.

    It does support the ASP.NET Web API and JSON. Curious that you thought otherwise, given that almost all BreezeJS samples are Web API samples that rely exclusively on the JSON content type.