接口定義**:
public interface IComputer
{
int Add<TEntity>(TEntity c);
}
Server實現**:
public class Computer : IComputer
{
public int Add<TEntity>(TEntity c) => 0;
}
Client調用(Spring.NET配置通道)**:
var remoteComputer = (IComputer)Program.SpringContext.GetObject("remotingComputer");
int res = remoteComputer.Add<GameRecordDetail>(new GameRecordDetail());
// 成功返回 0,無任何異常
GameRecordDetail為業務實體類,需[Serializable]或實現ISerializable。在接口添加第二個泛型重載方法int Add<TEntity>(IList<TEntity> list),觀察Client調用原方法是否異常,定位Bug觸發點。