【发布时间】:2012-08-01 01:55:22
【问题描述】:
我正在研究 WCF 数据服务。我的服务中有一个函数,它将记录添加到 SQL DB 中的表中并返回插入记录的 ID。
我曾经将要插入的值以参数的形式传递给函数。
举例
public int Add(string Name, string Password)
{
// Here I will Add the record and return the ID of the record added in DB
}
但我不想这样做以参数的形式传递。
我想直接传递对象。
喜欢
public int Add(User user)
{
// Here I will Add the record and return the ID of the record added in DB
}
我在我的服务中编写了上述功能,我的服务项目成功了。当我更新我的 ServiceRefrences 时,我得到 Error。
它说只支持原始类型。有什么解决办法 这个问题。
感谢您抽出宝贵时间回答我的问题。
【问题讨论】:
-
感谢 Anand 将开始这样做。其实我不熟悉使用堆栈溢出。谢谢你的建议。从现在开始我会这样做..
-
没问题。不客气!
标签: asp.net asp.net-mvc-3 wcf-data-services odata