When using examples for a single page application, I have the following TodoItem controller:
public partial class MVC4TestController : DbDataController<MVC4TestContext> { public IQueryable<TodoItem> GetTodoItems() { return DbContext.TodoItems.OrderBy(t => t.TodoItemId); } }
Question 1:
It seems that only EntityModels are supported?
When using a real ViewModel (a model used only for views, not used as a 1: 1 mapping for a database object), DbDataController does not support this.
Also using Linq.Translations or PropertyTranslator does not work, see this code snippet
private static readonly CompiledExpressionMap<TodoItem, string> fullExpression = DefaultTranslationOf<TodoItem>.Property(t => t.Full).Is(t => t.Title + "_" + t.IsDone); public string Full { get { return fullExpression.Evaluate(this); } }
Question 2:
What is the recommended design when using SPA, DBContext and ViewModels?
Stef heyenrath
source share