ldj/codeSmith/template/WcfInterface.cst

77 lines
3.0 KiB
Plaintext

<%@ CodeTemplate Language="C#" TargetLanguage="Text" Description="This template demonstrates using properties defined in external assemblies." %>
<%@ Property Name="SourceDatabase" Type="SchemaExplorer.DatabaseSchema" Category="Context" Description="Database that the documentation should be based on." %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="The table to use for this sample." %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<script runat="template">
<!-- #include file="scripts.cs" -->
</script>
/// <summary>
///WCF service
///Interface FOR TABLE <%=this.SourceTable.Name%>
///By wm
///on <%= DateTime.Now.ToString("MM/dd/yyyy")%>
/// </summary>
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Web;
using DeiNiu.wms.Data.Model.Wcf;
using DeiNiu.Wcf.erp.wcfData;
using DeiNiu.Utils;
namespace DeiNiu.Wcf
{
[ServiceContract]
public interface <%=getWcfSvcInterfaceName() %>
{
//http://localhost:8080/<%=getTableName()%>.svc/getobj?id=1
[OperationContract]
[WebInvoke(Method = "GET",RequestFormat = WebMessageFormat.Json,ResponseFormat = WebMessageFormat.Json,
UriTemplate = "getObj?id={id}")]
<%=getWcfClassName() %> getObj(int id);
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
UriTemplate = "add")]
enumDbResult add(<%=getWcfClassName() %> obj);
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
UriTemplate = "update")]
enumDbResult update(<%=getWcfClassName() %> obj);
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
UriTemplate = "delete")]
enumDbResult delete(<%=getWcfClassName() %> obj);
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
UriTemplate = "where?condition={condition}&pageno={pageno}")]
<%=getWcfClassName() %>List query(string condition, int pageno);
/*
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
UriTemplate = "addList")]
List<Result> addList(List<<%=getWcfClassName() %>> objs);
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
UriTemplate = "updateList")]
List<Result> updateList(List<<%=getWcfClassName() %>> objs);
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json,
UriTemplate = "deleteList")]
List<Result> deleteList(List<<%=getWcfClassName() %>> objs);
*/
}
}