订单接口调用问题

caiying_163 caiying_163 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我定义了一个接口类,具体的接口方法是:
T Insert<V>(IList<V> detailList, T masterObject ) //where U : new()
该接口的功能是实现订单主表和明细表同时插入数据

然后在另外一个类中具体实现了这个方法
public T Insert<V>(IList<V> detailList, T masterObject ) where U : new()
{
// 保存前先校验数据
if (!Verify(masterObject))
{
return default(T);
}

DBInterface<U> myDetail = new DBInterface<U>();

// 保存主表
Insert(masterObject);
Type myMaster = masterObject.GetType();
PropertyInfo masterInfo = myMaster.GetProperty("ID");


// 保存明细
foreach (U detail in detailList)
{
Type myType = detail.GetType();
PropertyInfo pinfo = myType.GetProperty("Order.ID");
pinfo.SetValue(detail, masterInfo.GetValue(masterObject,null), null);

myDetail.Insert(detail);
}

return masterObject;
}

但是在客户端调用的时候却无法调用到这个方法,也不提示什么错误。哪位高手能指点一二。先谢了。。
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
caiying_163
C# 111,128 成员 642,537 内容