using System.Web.Http; using System.Web.Http.Results; namespace EShangApi.Controllers { /// /// 基本信息接口 /// public class BaseController : ApiController { public SuperMap.RealEstate.ServiceModel.Transaction transaction = new SuperMap.RealEstate.ServiceModel.Transaction(); /// /// 重写返回方法(用于释放事物) /// /// /// /// protected override OkNegotiatedContentResult Ok(T content) { if (transaction.IsOpen) { transaction.Commit(); } transaction.Release(); transaction.Dispose(); return base.Ok(content); } } }