【发布时间】:2011-07-02 20:09:21
【问题描述】:
我有一个访问 SQL 和 Windows Azure 的 MVC 应用程序。逻辑流程如下所示:
Person <--> View <--> Controller.ConvertPersonHere(x) <--> StorageContext.DoDataAction <--> AzurePersonTableEntity
ConvertPersonHere 是this Stack Overflow question 的答案,它将模型实体转换为存储实体
public class Person
{
public string Name {get;set;}
public int ID {get;set;}
}
public class PersonEntity : TableServiceEntity
{
public string Name {get;set;}
public int ID {get;set;}
// Code to set PartitionKey
// Code to set RowKey
}
现在我将 WCF 添加到组合中,我应该如何访问数据函数?假设我目前在控制器中有一个
.Save(Person)的方法,并且想从我的 WCF 调用中Save(Person)。是否需要抽象出控制器中的数据操作?
【问题讨论】:
标签: wcf model-view-controller rest architecture dry