27 lines
796 B
C#
27 lines
796 B
C#
using System.Web.Http;
|
|
using System.Web.Http.Results;
|
|
|
|
namespace OpenApi.Controllers
|
|
{
|
|
public class BaseController : ApiController
|
|
{
|
|
public SuperMap.RealEstate.ServiceModel.Transaction transaction = new SuperMap.RealEstate.ServiceModel.Transaction();
|
|
|
|
/// <summary>
|
|
/// 重写返回方法(用于释放事物)
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
/// <param name="content"></param>
|
|
/// <returns></returns>
|
|
protected override OkNegotiatedContentResult<T> Ok<T>(T content)
|
|
{
|
|
if (transaction.IsOpen)
|
|
{
|
|
transaction.Commit();
|
|
}
|
|
transaction.Release();
|
|
transaction.Dispose();
|
|
return base.Ok(content);
|
|
}
|
|
}
|
|
} |