/trunk/OGen-NTier/NTier_templates/PRJ-RS-Someapp-remoting-server-RS0_Somebo.cs.aspx

https://github.com/ogen-project/ogen · ASP.NET · 107 lines · 0 code · 0 blank · 107 comment · 0 complexity · 7b72ccc6dec25162740719d3a0b8bebb MD5 · raw file

  1. <%--
  2. OGen
  3. Copyright (C) 2002 Francisco Monteiro
  4. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  5. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  6. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  7. --%><%@ Page language="c#" contenttype="text/html" %>
  8. <%@ import namespace="OGen.Libraries.DataLayer" %>
  9. <%@ import namespace="OGen.NTier.Libraries.Metadata" %>
  10. <%@ import namespace="OGen.NTier.Libraries.Metadata.MetadataExtended" %>
  11. <%@ import namespace="OGen.NTier.Libraries.Metadata.MetadataDB" %>
  12. <%@ import namespace="OGen.NTier.Libraries.Metadata.MetadataBusiness" %><%
  13. #region arguments...
  14. string _arg_MetadataFilePath = System.Web.HttpUtility.UrlDecode(Request.QueryString["MetadataFilePath"]);
  15. string _arg_ClassName = System.Web.HttpUtility.UrlDecode(Request.QueryString["ClassName"]);
  16. bool _arg_Client = bool.Parse(System.Web.HttpUtility.UrlDecode(Request.QueryString["Client"]));
  17. #endregion
  18. #region varaux...
  19. XS__RootMetadata _aux_root_metadata = XS__RootMetadata.Load_fromFile(
  20. _arg_MetadataFilePath,
  21. true,
  22. false
  23. );
  24. XS__metadataDB _aux_db_metadata = _aux_root_metadata.MetadataDBCollection[0];
  25. XS__metadataExtended _aux_ex_metadata = _aux_root_metadata.MetadataExtendedCollection[0];
  26. XS__metadataBusiness _aux_business_metadata = _aux_root_metadata.MetadataBusinessCollection[0];
  27. OGen.NTier.Libraries.Metadata.MetadataBusiness.XS_classType _aux_class
  28. = _aux_business_metadata.Classes.ClassCollection[
  29. _arg_ClassName
  30. ];
  31. XS_methodType _aux_method;
  32. XS_parameterType _aux_parameter;
  33. #endregion
  34. //-----------------------------------------------------------------------------------------
  35. if (!string.IsNullOrEmpty(_aux_ex_metadata.CopyrightText)) {
  36. if (string.IsNullOrEmpty(_aux_ex_metadata.CopyrightTextLong)) {
  37. %>#region <%=_aux_ex_metadata.CopyrightText%>
  38. #endregion
  39. <%
  40. } else {
  41. %>#region <%=_aux_ex_metadata.CopyrightText%>
  42. /*
  43. <%=_aux_ex_metadata.CopyrightTextLong%>
  44. */
  45. #endregion
  46. <%
  47. }
  48. }%>
  49. namespace <%=_aux_ex_metadata.ApplicationNamespace%>.Libraries.DistributedLayer.Remoting.Server {
  50. using System;
  51. <%
  52. if (!_arg_Client) {%>
  53. using <%=_aux_ex_metadata.ApplicationNamespace%>.Libraries.BusinessLayer;<%
  54. }%>
  55. using <%=_aux_ex_metadata.ApplicationNamespace%>.Libraries.BusinessLayer.Shared;
  56. using <%=_aux_ex_metadata.ApplicationNamespace%>.Libraries.BusinessLayer.Shared.Structures;
  57. using <%=_aux_ex_metadata.ApplicationNamespace%>.Libraries.DataLayer.Shared.Structures;
  58. /// <summary>
  59. /// <%=_aux_class.Name%> remoting server.
  60. /// </summary>
  61. public class RS_<%=_aux_class.Name%> :
  62. MarshalByRefObject,
  63. IBO_<%=_aux_class.Name%>
  64. {<%
  65. for (int m = 0; m < _aux_class.Methods.MethodCollection.Count; m++) {
  66. _aux_method = _aux_class.Methods.MethodCollection[m];%>
  67. #region public <%=_aux_method.OutputType%> <%=_aux_method.Name%>(...);
  68. public <%=_aux_method.OutputType%> <%=_aux_method.Name%>(<%
  69. for (int p = 0; p < _aux_method.Parameters.ParameterCollection.Count; p++) {
  70. _aux_parameter = _aux_method.Parameters.ParameterCollection[p];%><%=""%>
  71. <%=_aux_parameter.IsOut ? "out " : ""%><%=_aux_parameter.IsRef ? "ref " : ""%><%=_aux_parameter.IsParams ? "params " : ""%><%=_aux_parameter.Type%><%=_aux_parameter.IsParams ? "[]" : ""%> <%=_aux_parameter.Name%><%=(p == _aux_method.Parameters.ParameterCollection.Count - 1) ? "" : ", "%><%
  72. }%>
  73. ) {<%
  74. if (_arg_Client) {%><%=""%>
  75. throw new Exception("your not calling the remoting server, but the client's remoting server implementation");<%
  76. } else {%><%=""%>
  77. <%=(_aux_method.OutputType == "void") ? "" : "return "%><%=_aux_class.Namespace%>.SBO_<%=_aux_class.Name%>.<%=_aux_method.Name%>(<%
  78. for (int p = 0; p < _aux_method.Parameters.ParameterCollection.Count; p++) {
  79. _aux_parameter = _aux_method.Parameters.ParameterCollection[p];
  80. if (_aux_method.IPParamNum == p) {%><%=""%>
  81. <%=_aux_parameter.IsOut ? "out " : ""%><%=_aux_parameter.IsRef ? "ref " : ""%><%=_aux_parameter.IsParams ? "params " : ""%>(Utilities.ResetClientIP)
  82. ? (string)System.Runtime.Remoting.Messaging.CallContext.GetData("ClientIPAddress")
  83. : <%=_aux_parameter.Name%><%=(p == _aux_method.Parameters.ParameterCollection.Count - 1) ? "" : ", "%><%
  84. } else {%><%=""%>
  85. <%=_aux_parameter.IsOut ? "out " : ""%><%=_aux_parameter.IsRef ? "ref " : ""%><%=_aux_parameter.IsParams ? "params " : ""%><%=_aux_parameter.Name%><%=(p == _aux_method.Parameters.ParameterCollection.Count - 1) ? "" : ", "%><%
  86. }
  87. }%>
  88. );<%
  89. }%>
  90. }
  91. #endregion<%
  92. }%>
  93. }
  94. }<%
  95. //-----------------------------------------------------------------------------------------
  96. %>