/// <summary> /// 创建合约 /// </summary> public IContract CreateContract <T>(IContractData contractData) where T : IContract { IContract contract = Activator.CreateInstance <T>(); contract.Id = Guid.NewGuid().ToString(); contract.ContractData = contractData; return(contract); }
/// <summary> /// 解析合约 /// </summary> public IContract ParseContract <T1, T2>(string id, string jsonData) where T1 : IContract where T2 : IContractData { IContractData contractData = JsonConvert.DeserializeObject <T2>(jsonData); IContract contract = null; if (contractData != null && !string.IsNullOrEmpty(id)) { contract = Activator.CreateInstance <T1>(); contract.Id = id; contract.ContractData = contractData; } return(contract); }
/// <summary> /// 异步方法,通过SQL语句与 <see cref="Hashtable"/>[] 参数进行数据更新,SQL文无where部分将导致操作失败, /// 通过<see cref="AgentClient.Result(Guid)"/>取回异步执行结果, /// 返回结果<see cref="object"/> <see cref="IServiceResult.AppendData"/> 为受影响行数,实际类型:<see cref="int"/> /// </summary> /// <param name="data"></param> /// <returns></returns> public Guid UpdateAsync(IContractData data) { return(Channel.UpdateAsync(data.Compression()).Decompress <Guid>()); }
/// <summary> /// 同步方法,通过SQL语句与 <see cref="Hashtable"/>[] 参数进行数据插入, /// 返回结果<see cref="object"/> <see cref="IServiceResult.AppendData"/> 为受影响行数,实际类型:<see cref="int"/> /// </summary> /// <param name="data"></param> /// <returns></returns> public IServiceResult Insert(IContractData data) { return(Channel.Insert(data.Compression()).Decompress <IServiceResult>()); }
/// <summary> /// 同步方法,通过SQL语句与 <see cref="Hashtable"/>[] 参数进行数据更新,SQL文无where部分将导致操作失败, /// 返回结果<see cref="object"/> <see cref="IServiceResult.AppendData"/> 为受影响行数,实际类型:<see cref="int"/> /// </summary> /// <param name="data"></param> /// <returns></returns> public IServiceResult Update(IContractData data) { return(Channel.Update(data.Compression()).Decompress <IServiceResult>()); }
/// <summary> /// 异步方法,通过SQL语句、<see cref="DataSet"/>与数据适配器进行操作,返回受影响的行数, /// 通过<see cref="AgentClient.Result(Guid)"/>取回异步执行结果, /// 返回结果<see cref="object"/> <see cref="IServiceResult.AppendData"/> ,实际类型:<see cref="int"/> /// </summary> /// <param name="data"></param> /// <returns></returns> public Guid AdapterSetAsync(IContractData data) { return(Channel.AdapterSet(data.Compression()).Decompress <Guid>()); }
/// <summary> /// 同步方法,通过SQL语句、<see cref="DataSet"/>与数据适配器进行操作,返回受影响的行数, /// 返回结果<see cref="object"/> <see cref="IServiceResult.AppendData"/> ,实际类型:存储过程实际返回类型 /// </summary> /// <param name="data"></param> /// <returns></returns> public IServiceResult AdapterSet(IContractData data) { return(Channel.AdapterSet(data.Compression()).Decompress <IServiceResult>()); }
/// <summary> /// 异步方法,通过存储过程名称与 <see cref="Hashtable"/>[] 执行存储过程, /// 通过<see cref="AgentClient.Result(Guid)"/>取回异步执行结果, /// 返回结果<see cref="object"/> <see cref="IServiceResult.AppendData"/> ,实际类型:存储过程实际返回类型 /// </summary> /// <param name="data"></param> /// <returns></returns> public Guid ExecuteProcedureAsync(IContractData data) { return(Channel.ExecuteProcedureAsync(data.Compression()).Decompress <Guid>()); }
/// <summary> /// 同步方法,通过存储过程名称与 <see cref="Hashtable"/>[] 执行存储过程, /// 返回结果<see cref="object"/> <see cref="IServiceResult.AppendData"/> ,实际类型:存储过程实际返回类型 /// </summary> /// <param name="data"></param> /// <returns></returns> public IServiceResult ExecuteProcedure(IContractData data) { return(Channel.ExecuteProcedure(data.Compression()).Decompress <IServiceResult>()); }
public Contract(IContractData contractData) { _contractData = contractData; }