Concerns about ASP.NET SPA(Single Page Application)

1.9k Views Asked by At

Here is my knowing about ASP.NET SPA:

  1. have to use Upshot to talk to the server;
  2. have to use DbDataController to provide Web APIs;
  3. have to use Entity Framework Code first...

so, many concerns come out:

  1. have to provide metadata for the upshot to work, this will obviously expose the structure of your database;
  2. can i use Entity Framework Database First instead of Code First? You may ask why. Because Code First don't provide you the ability to customize your database(index customization, stored procedure...etc.);
  3. A problem i met: when i add a "TestUpshot.edmx" file(generated from database 'northwind') to the MySpaApp.Models folder(trying to test whether i can use the edmx classes in the MyDbDataController class, and generate proper metadata in the client side), and run the application, there is an exception:"System.ArgumentException: Could not find the conceptual model type for MySpaApp.Models.Categories."...

Need help here, thanks in advance.

Dean

2

There are 2 best solutions below

1
On

SPA is actually a way to conceptualize your client application. SPA comes the closest to the fat client - data server concept from the current web approaches. Definitely this will be the ruling concept within a couple of years.

Your concerns can be addressed using JayData at http://jaydata.codeplex.com that provides advanced, high level data access for JavaScript against any kind of EntityFramework back-ends (db, model or code first). Check out this video that presents the whole cycle from importing your EDMX from SQL (this could eighter be model first definition as well) to inserting a new product item in the Products table from JavaScript.

8
On

I may be missing something, but there is no requirement to use any of the technologies you've listed.

An SPA is just a pattern. You can use whatever you need to achieve that. There may be benefits with choosing certain technologies, ie templates, tutorials, etc.

Doesn't really answer your question, but should lead you to experiment with what you've got.