Index: Source/DataAccessLayer.WebService/ServiceLayer.WebService.cst =================================================================== --- Source/DataAccessLayer.WebService/ServiceLayer.WebService.cst (revision 552) +++ Source/DataAccessLayer.WebService/ServiceLayer.WebService.cst (working copy) @@ -15,502 +15,8 @@ <%@ Import Namespace="SchemaExplorer" %> <%@ Import Namespace="System.Collections" %> -<%@ Property Name="SourceTables" Type="SchemaExplorer.TableSchemaCollection" Category="Context" Description="Tables that the stored procedures should be based on." %> -<%@ Property Name="SourceViews" Type="SchemaExplorer.ViewSchemaCollection" Category="Context" Description="views that the data access class should be based on." %> - -<%@ Property Name="IncludeCustoms" Type="System.Boolean" Default="True" Category="Options" Description="If true customs stored procedures will be generated as functions." %> -<%@ Property Name="CustomNonMatchingReturnType" Type="CustomNonMatchingReturnType" Default="DataSet" Category="Options" Description="When using custom stored procedures, if the returned rows do not match the fields in an entity, a DataSet or IDataReader will be returned. Choose One. This is useful if you've returned more than one resultset in a custom procedure; you can use a ConvertToDataSet(IDataReader) method in the Utility class to convert that to a DataSet." %> - -<%@ Property Name="IncludeInsert" Type="System.Boolean" Default="True" Category="Options" Description="If true insert functions will be generated." %> -<%@ Property Name="IncludeUpdate" Type="System.Boolean" Default="True" Category="Options" Description="If true update functions will be generated." %> -<%@ Property Name="IncludeDelete" Type="System.Boolean" Default="True" Category="Options" Description="If true delete functions will be generated." %> -<%@ Property Name="IncludeGetList" Type="System.Boolean" Default="True" Category="Options" Description="If true getlist functions will be generated." %> -<%@ Property Name="IncludeGetListByFK" Type="System.Boolean" Default="True" Category="Options" Description="If true get functions will be generated." %> -<%@ Property Name="IncludeGetListByIX" Type="System.Boolean" Default="True" Category="Options" Description="If true getlist functions will be generated." %> -<%@ Property Name="IncludeFind" Type="System.Boolean" Default="False" Category="Options" Description="If true find functions will be generated." %> -<%@ Property Name="IncludeManyToMany" Type="System.Boolean" Default="True" Category="Options" Description="If true select statements will be generated for any many to many relationship." %> - -<%@ Property Name="NameSpace" Type="System.String" Category="Data" Description="Class Namespace." %> - -<%@ Property Name="BLLNameSpace" Type="System.String" Category="Data" Description="BLL Namespace." %> -<%@ Property Name="ComponentsNameSpace" Type="System.String" Category="Data" Description="Component Service Layer Namespace." %> - <%@ Property Name="ClassName" Type="System.String" Category="Style" Description="The Name of the WebService class." %> -<%@ Property Name="WebServiceUrl" Type="System.String" Category="Style" Description="The webservice base URL. The asmx filename will be added programmatically." Default="http://localhost/Services/" %> <%%@ WebService Language="C#" Class="<%=ClassName%>" %> -<%%@ Assembly Name="<%=BLLNameSpace%>" %> -<%%@ Assembly Name="<%=ComponentsNameSpace%>" %> -using System; -using System.Data; -using System.Web.Services; -using <%=BLLNameSpace%>; -using <%=ComponentsNameSpace%>; - - -/// -/// Exposes CRUD webmethods for the <%=ClassName%> Database. -/// -[WebService(Namespace="<%=WebServiceUrl%>", Description="Exposes CRUD webmethods for the <%=ClassName%> Database.")] -public class <%=ClassName%> : WebService -{ - <% - for (int tableIndex = 0; tableIndex < SourceTables.Count; tableIndex++) - { - // point to the current table - SchemaExplorer.TableSchema SourceTable = SourceTables[tableIndex]; - - // True if primary key is AutoGenerated by database. - //bool IsPkeyReadOnly = false; - - // Name of the table being worked on. - string name = SourceTable.Name; - string className = NameSpace + "." + GetClassName(SourceTable.Name); - string serviceClassName = GetServiceClassName(SourceTable.Name); - string collectionClassName = NameSpace + "." + GetCollectionClassName(SourceTable.Name); - - string commandStem = GetCleanName(SourceTable.Name); - string providerName = GetProviderName(SourceTable.Name); - - // Collection of all columns in the table. - ColumnSchemaCollection cols = SourceTable.Columns; - - // Collection of all columns in the table that are not primary keys. - ColumnSchemaCollection nonKeys = SourceTable.NonPrimaryKeyColumns; - - // Collection of all primary key columns. - ColumnSchemaCollection keys = SourceTable.PrimaryKey.MemberColumns; - - // Collection of ForeignKeys. Provides information about the foreign keys - //(keys where the current table is the foreign table) contained in the table. - TableKeySchemaCollection fkeys = SourceTable.ForeignKeys; - - //Provides information about the primary keys - //(keys where the current table is the primary table) contained in the table. - TableKeySchemaCollection pkeys = SourceTable.PrimaryKeys; - - //Provides information about the indexes contained in the table. - IndexSchemaCollection indexes = SourceTable.Indexes; - - //the first of potentially multiple primary keys - //ColumnSchema primaryKey = keys[0]; - - - // Holds the RowVersion column if there's any - ColumnSchema RowVersion = null; - - foreach (ColumnSchema column in cols) - { - if (column.NativeType.ToLower() == "timestamp") - RowVersion = column; - } - - // this array store each Get BY MemberColumns in order to avoid to create doublon Get methods - System.Collections.ArrayList getbyKeys = new System.Collections.ArrayList(); -%> - - #region <%=SourceTable.Name%> - - <% if(IncludeManyToMany) { %> - #region Get from Many To Many Relationship Functions - <% - TableSchema primaryTable = SourceTable; - - foreach(TableKeySchema key in SourceTable.PrimaryKeys) - { - // Check that the key is related to a junction table and that this key relate a PK in this junction table - if ( IsJunctionTable(key.ForeignKeyTable) && IsJunctionKey(key)) - { - TableSchema junctionTable = key.ForeignKeyTable; - - // Search for the other(s) key(s) of the junction table' primary key - foreach(TableKeySchema junctionTableKey in junctionTable.ForeignKeys) - { - if ( IsJunctionKey(junctionTableKey) && junctionTableKey.Name != key.Name ) - { - TableSchema secondaryTable = junctionTableKey.PrimaryKeyTable; - string functionname = GetManyToManyName(junctionTableKey, GetCleanName(junctionTable.Name)); -%> - - #region GetBy<%=functionname%> - /// - /// Gets <%=primaryTable.Name%> objects from the datasource by <%=junctionTableKey.ForeignKeyMemberColumns[0].Name%> in the - /// <%=junctionTable.Name%> table. Table <%=primaryTable.Name%> is related to table <%=secondaryTable.Name%> - /// through the (M:N) relationship defined in the <%=junctionTable.Name%> table. - /// - /// Row number at which to start reading, the first row is 0. - /// Number of rows to return. - /// out parameter to get total records for query - [WebMethod(Description="Get rows from the table <%=SourceTable.Name%>, through the junction table <%=junctionTable.Name%>.")] - public <%=NameSpace + "." + GetCollectionClassName(primaryTable.Name)%> <%=providerName%>_GetBy<%=functionname%>(<%=GetFunctionHeaderParameters(junctionTableKey.ForeignKeyMemberColumns)%>, int start, int pageLength, out int count) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.GetBy<%=functionname%>(<%=GetFunctionCallParameters(junctionTableKey.ForeignKeyMemberColumns)%>, start, pageLength, out count); - } - - #endregion GetBy<%=functionname%> - - <% - } //end if there is many to many relationship. - } //end foreach - }// end if(IsJunctionTable(junctionTableKeyForeignKeyTable)) %> - <%}//end foreach pkey %> - #endregion - <% } %> - - <% if (IncludeDelete) {%> - #region <%= MethodNames.Delete %> Functions - - /// - /// Deletes a row from the DataSource. - /// - <% for (int i = 0; i < keys.Count; i++) { %> - /// <%= GetColumnXmlComment(keys[i],1)%>. Primary Key. - <% } %> - /// object - /// Connection string to datasource. - /// Deletes based on primary key(s). - /// Returns true if operation suceeded. - [WebMethod(Description="Delete a row from the table <%=SourceTable.Name%>.")] - public bool <%=providerName%>_<%= MethodNames.Delete %>(<%= GetFunctionHeaderParameters(keys) %><% if(RowVersion != null) {Response.Write(", byte[] " + GetPrivateName(RowVersion));}%>) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.<%= MethodNames.Delete %>(<%= GetFunctionCallParameters(keys) %><% if(RowVersion != null) {Response.Write(", " + GetPrivateName(RowVersion));}%>); - } - - #endregion - <% } %> - - <% if (IncludeFind) { %> - #region <%= MethodNames.Find %> Functions - - /// - /// Returns rows meeting the whereclause condition from the DataSource. - /// - /// Specifies the condition for the rows returned by a query. - /// - /// Returns a DataSet. - [WebMethod(Description="Get rows from the table <%=SourceTable.Name%> with additional query text.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.Find %>(string whereClause, int start, int pageLength, out int count) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.<%= MethodNames.Find %>(whereClause, start, pageLength, out count); - } - - #endregion <%= MethodNames.Find %> Functions - <% } %> - - - <% if (IncludeGetList) { %> - #region <%= MethodNames.GetAll %> Functions - - /// - /// Gets All rows from the DataSource. - /// - /// Row number at which to start reading. - /// Number of rows to return. - /// Number of rows in the DataSource. - /// Returns a DataSet. - [WebMethod(Description="Get all rows from the table <%=SourceTable.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.GetAll %>(int start, int pageLength, out int count) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.<%= MethodNames.GetAll %>(start, pageLength, out count); - } - - #endregion - - #region <%= MethodNames.GetPaged %> - - /// - /// Gets a page of rows from the DataSource. - /// - /// Row number at which to start reading. - /// Number of rows to return. - /// Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1'). - /// Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC); - /// Number of rows in the DataSource. - /// - /// Returns a typed collection of <%=ClassName%> objects. - [WebMethod(Description="Get all rows from the table <%=SourceTable.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.GetPaged %>(string whereClause, string orderBy, int start, int pageLength, out int count) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.<%= MethodNames.GetPaged %>(whereClause, orderBy, start, pageLength, out count); - } - - #endregion - <% } %> - - <% if (IncludeGetListByFK) { %> - #region Get By Foreign Key Functions -<% - for (int j=0; j < fkeys.Count;j++) - { - if(IsForeignKeyCoveredByIndex(fkeys[j])) - continue; - - getbyKeys.Add(GetKeysName(fkeys[j].ForeignKeyMemberColumns)); -%> - - /// - /// Gets rows from the datasource based on the <%=fkeys[j].Name%> key. - /// <%=fkeys[j].Name%> Description: <%=GetColumnXmlComment(fkeys[j],1)%> - /// - /// Row number at which to start reading. - /// Number of rows to return. -<% for (int i = 0; i < fkeys[j].ForeignKeyMemberColumns.Count; i++) { %> - /// <%=GetColumnXmlComment(fkeys[j].ForeignKeyMemberColumns[i],1)%> -<% } %> - /// out parameter to get total records for query - /// - /// Returns a DataSet. - [WebMethod(Description="Get rows from <%=SourceTable.Name%> filtered by the <%=GetKeysName(fkeys[j].ForeignKeyMemberColumns)%> column.")] - public <%=collectionClassName%> <%=providerName%>_GetBy<%=GetKeysName(fkeys[j].ForeignKeyMemberColumns)%>(<%= GetFunctionHeaderParameters(fkeys[j].ForeignKeyMemberColumns) %>, int start, int pageLength, out int count) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.GetBy<%=GetKeysName(fkeys[j].ForeignKeyMemberColumns)%>(<%= GetFunctionCallParameters(fkeys[j].ForeignKeyMemberColumns) %>, start, pageLength, out count); - } - -<% }//endfor %> -#endregion - <% } %> - - <% if (IncludeGetListByIX) { %> - #region Get By Index Functions - <% - for (int j=0; j < indexes.Count;j++) - { - // Check if this key is not already generated - if(getbyKeys.IndexOf(GetKeysName(indexes[j].MemberColumns)) >=0 ) - { - continue; - } - else - { - // add this key to the index list - getbyKeys.Add(GetKeysName(indexes[j].MemberColumns)); - } - - string returnType = collectionClassName; - bool isUnique = false; - - if (indexes[j].IsUnique || indexes[j].IsPrimaryKey) - { - returnType = className; - isUnique = true; - } -%> - - /// - /// Gets rows from the datasource based on the <%=indexes[j].Name%> index. - /// - /// Row number at which to start reading. - /// Number of rows to return. -<% for (int i = 0; i < indexes[j].MemberColumns.Count; i++) { %> - /// <%= GetColumnXmlComment(indexes[j].MemberColumns[i],1)%> -<% } %> - /// out parameter to get total records for query - /// Returns a DataSet. - [WebMethod(Description="Get rows from the table <%=SourceTable.Name%> filtered by the column <%=GetKeysName(indexes[j].MemberColumns)%> that is part of the <%=indexes[j].Name%> index.")] - public <%=returnType%> <%=providerName%>_GetBy<%=GetKeysName(indexes[j].MemberColumns)%>(<%= GetFunctionHeaderParameters(indexes[j].MemberColumns) %>, int start, int pageLength, out int count) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.GetBy<%=GetKeysName(indexes[j].MemberColumns)%>(<%= GetFunctionCallParameters(indexes[j].MemberColumns) %>, start, pageLength, out count); - } - - -<% }//endfor %> - #endregion Get By Index Functions - <% } %> - - <% if (IncludeInsert) { %> - #region <%= MethodNames.Insert %> Methods - - /// - /// Inserts an object into the datasource. - /// - /// After inserting into the datasource, the object will be returned - /// to refelect any changes made by the datasource. (ie: identity columns) - /// Returns true if operation is successful. - [WebMethod(Description="Inserts a row in the table <%=SourceTable.Name%>.")] - public <%=className%> <%=providerName%>_<%= MethodNames.Insert %>(<%=className%> entity ) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - serviceObject.<%= MethodNames.Insert %>(entity); - return entity; - } - - /// - /// Inserts a <%=collectionClassName%> object into the datasource using a transaction. - /// - /// <%=collectionClassName%> object to insert. - /// After inserting into the datasource, the <%=className%> object will be updated - /// to refelect any changes made by the datasource. (ie: identity or computed columns) - /// - /// Returns true if operation is successful. - [WebMethod(Description="Inserts a Bulk set of rows into the table <%=SourceTable.Name%>.")] - public void <%=providerName%>_<%= MethodNames.BulkInsert %>(<%=collectionClassName%> entityList ) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - serviceObject.<%= MethodNames.BulkInsert %>(entityList); - } - #endregion <%= MethodNames.Insert %> Methods - <% } %> - - <% if (IncludeUpdate) { %> - #region <%= MethodNames.Update %> Methods - - /// - /// Update an existing row in the datasource. - /// - /// object to update. - /// After updating the datasource, the object will be updated - /// to refelect any changes made by the datasource. (ie: identity columns) - /// Returns true if operation is successful. - [WebMethod(Description="Update a row in the table <%=SourceTable.Name%>.")] - public <%=className%> <%=providerName%>_<%= MethodNames.Update %>(<%=className%> entity) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - serviceObject.<%= MethodNames.Update %>(entity); - return entity; - } - - #endregion <%= MethodNames.Update %> Methods - <% } %> - - <% if (IncludeCustoms) { %> - #region Custom Methods - -<% - System.Collections.IDictionary procs = GetCustomProcedures(SourceTable); - - foreach(DictionaryEntry item in procs) - { - SchemaExplorer.CommandSchema command = (SchemaExplorer.CommandSchema) item.Value; - string methodName = item.Key.ToString(); - - string returnType = GetReturnCustomProcReturnType(CustomNonMatchingReturnType, SourceTable, command); - string returnKeyword = returnType == "void" ? "" : "return "; - if (returnType == "IDataReader") - returnType = "DataSet"; -%> - /// - /// This method wrap the <%=command.Name%> stored procedure. - /// - [WebMethod(Description="This method wrap the <%=command.Name%> stored procedure.")] - public <%=returnType%> <%=providerName%>_<%=methodName%>(<%=TransformStoredProcedureInputsToMethod(false, command.InputParameters) + TransformStoredProcedureOutputsToMethod((command.InputParameters.Count > 0), command.AllOutputParameters)%>)//<% if ( command.InputParameters.Count > 0 ) { %>, <% } %>int start, int pageLength) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - - <% if (returnType == "DataSet") { %> - <%= returnKeyword %> <% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %><%=ComponentsNameSpace%>.DomainUtil.ConvertDataReaderToDataSet(<%}%>serviceObject.<%=methodName%>(<%=TransformStoredProcedureInputsToDataAccess(false, command.InputParameters) + TransformStoredProcedureOutputsToDataAccess((command.InputParameters.Count > 0), command.AllOutputParameters)%>)/*<% if ( (command.InputParameters.Count + command.AllOutputParameters.Count) > 0 ) { %>, <% } %>start, pageLength )*/<% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %>)<%}%>; - <% } else { %> - <%= returnKeyword %> serviceObject.<%=methodName%>(<%=TransformStoredProcedureInputsToDataAccess(false, command.InputParameters) + TransformStoredProcedureOutputsToDataAccess((command.InputParameters.Count > 0), command.AllOutputParameters)%>);//<% if ( command.InputParameters.Count + command.AllOutputParameters.Count > 0 ) { %>, <% } %>start, pageLength ); - <% } %> - } - -<% - } -%> - - #endregion - <% } %> - - #endregion <%=SourceTable.Name%> -<% } /* END For each DataTable */ %> - - - /* -------------------------------------------------------- - SQL VIEWS - ----------------------------------------------------------- */ - <% foreach(ViewSchema SourceView in SourceViews) - { - string className = NameSpace + "." + GetClassName(SourceView.Name); - string serviceClassName = GetServiceClassName(SourceView.Name); - string providerName = GetProviderName(SourceView.Name); - string collectionClassName = NameSpace + "." + GetViewCollectionClassName(SourceView.Name); - %> - - <% if (IncludeGetList) { %> - #region <%= MethodNames.GetAll %> Methods - - /// - /// Gets All rows from the DataSource. - /// - /// Returns a DataSet. - [WebMethod(Description="Get all rows from the view <%=SourceView.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.GetAll %>(int start, int pageLength, out int count) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.<%= MethodNames.GetAll %>(start, pageLength, out count); - } - - #endregion <%= MethodNames.GetAll %> Methods - <% } %> - - #region <%= MethodNames.Get %> Methods - - /// - /// Gets a page of rows from the DataSource. - /// - /// Specifies the condition for the rows returned by a query. - /// Specifies the ORDER By criteria for the rows in the DataSource. - /// - /// Returns a typed collection of <%=ClassName%> objects. - [WebMethod(Description="Get all rows from the view <%=SourceView.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.Get %>(string whereClause, string orderBy, int start, int pageLength) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - return serviceObject.<%= MethodNames.Get %>(whereClause.Length > 0 ? whereClause : null, orderBy.Length > 0 ? orderBy : null, start, pageLength); - } - - #endregion <%= MethodNames.Get %> Methods - - <% if (IncludeCustoms) { %> - #region Custom Methods - -<% - System.Collections.IDictionary procs = GetCustomProcedures(SourceView); - - foreach(DictionaryEntry item in procs) - { - SchemaExplorer.CommandSchema command = (SchemaExplorer.CommandSchema) item.Value; - string methodName = item.Key.ToString(); - - string returnType = GetReturnCustomProcReturnType(CustomNonMatchingReturnType, SourceView, command); - string returnKeyword = returnType == "void" ? "" : "return "; - if (returnType == "IDataReader") - returnType = "DataSet"; -%> - - /// - /// This method wrap the <%=command.Name%> stored procedure. - /// - [WebMethod(Description="This method wrap the <%=command.Name%> stored procedure.")] - public <%=returnType%> <%=providerName%>_<%=methodName%>(<%=TransformStoredProcedureInputsToMethod(false, command.InputParameters)%>)//<% if ( command.InputParameters.Count > 0 ) { %>, <% } %>int start, int pageLength) - { - <%=serviceClassName%> serviceObject = new <%=serviceClassName%>(); - - <% if (returnType == "DataSet") { %> - //<%= returnKeyword %> <% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %><%=ComponentsNameSpace%>.DomainUtil.ConvertDataReaderToDataSet(<%}%>serviceObject.<%=methodName%>(<%=TransformStoredProcedureInputsToDataAccess(false, command.InputParameters) + TransformStoredProcedureOutputsToDataAccess((command.InputParameters.Count > 0), command.AllOutputParameters)%><% if ( (command.InputParameters.Count + command.AllOutputParameters.Count) > 0 ) { %>, <% } %>start, pageLength )<% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %>)<%}%>; - <%= returnKeyword %> <% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %><%=ComponentsNameSpace%>.DomainUtil.ConvertDataReaderToDataSet(<%}%>serviceObject.<%=methodName%>(<%=TransformStoredProcedureInputsToDataAccess(false, command.InputParameters) %>)/*<% if ( (command.InputParameters.Count) > 0 ) { %>, <% } %>start, pageLength )*/<% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %>)<%}%>; - <% } else { %> - <%= returnKeyword %> serviceObject.<%=methodName%>(<%=TransformStoredProcedureInputsToDataAccess(false, command.InputParameters)%>);//<% if ( command.InputParameters.Count > 0 ) { %>, <% } %>start, pageLength ); - <% } %> - - } - - -<% - } // foreach command -%> - - #endregion - <% } %> - -<% } %> - -} Index: Source/DataAccessLayer.WebService/WebService.cst =================================================================== --- Source/DataAccessLayer.WebService/WebService.cst (revision 552) +++ Source/DataAccessLayer.WebService/WebService.cst (working copy) @@ -10,630 +10,6 @@ <%@ Import Namespace="SchemaExplorer" %> <%@ Import Namespace="System.Collections" %> -<%@ Property Name="SourceTables" Type="SchemaExplorer.TableSchemaCollection" Category="Context" Description="Tables that the stored procedures should be based on." %> -<%@ Property Name="SourceViews" Type="SchemaExplorer.ViewSchemaCollection" Category="Context" Description="views that the data access class should be based on." %> -<%@ Property Name="IncludeCustoms" Type="System.Boolean" Default="True" Category="Options" Description="If true customs stored procedures will be generated as functions." %> -<%@ Property Name="CustomNonMatchingReturnType" Type="CustomNonMatchingReturnType" Default="DataSet" Category="Options" Description="When using custom stored procedures, if the returned rows do not match the fields in an entity, a DataSet or IDataReader will be returned. Choose One. This is useful if you've returned more than one resultset in a custom procedure; you can use a ConvertToDataSet(IDataReader) method in the Utility class to convert that to a DataSet." %> - -<%@ Property Name="IncludeInsert" Type="System.Boolean" Default="True" Category="Options" Description="If true insert functions will be generated." %> -<%@ Property Name="IncludeUpdate" Type="System.Boolean" Default="True" Category="Options" Description="If true update functions will be generated." %> -<%@ Property Name="IncludeDelete" Type="System.Boolean" Default="True" Category="Options" Description="If true delete functions will be generated." %> -<%@ Property Name="IncludeGetList" Type="System.Boolean" Default="True" Category="Options" Description="If true getlist functions will be generated." %> -<%@ Property Name="IncludeGetListByFK" Type="System.Boolean" Default="True" Category="Options" Description="If true get functions will be generated." %> -<%@ Property Name="IncludeGetListByIX" Type="System.Boolean" Default="True" Category="Options" Description="If true getlist functions will be generated." %> -<%@ Property Name="IncludeFind" Type="System.Boolean" Default="False" Category="Options" Description="If true find functions will be generated." %> -<%@ Property Name="IncludeManyToMany" Type="System.Boolean" Default="True" Category="Options" Description="If true select statements will be generated for any many to many relationship." %> - -<%@ Property Name="NameSpace" Type="System.String" Category="Data" Description="Class Namespace." %> - -<%@ Property Name="BLLNameSpace" Type="System.String" Category="Data" Description="BLL Namespace." %> -<%@ Property Name="DALNameSpace" Type="System.String" Category="Data" Description="DAL Namespace." %> - <%@ Property Name="ClassName" Type="System.String" Category="Style" Description="The Name of the WebService class." %> -<%@ Property Name="WebServiceUrl" Type="System.String" Category="Style" Description="The webservice base URL. The asmx filename will be added programmatically." Default="http://localhost/Services/" %> <%%@ WebService Language="C#" Class="<%=ClassName%>" %> -<%%@ Assembly Name="<%=BLLNameSpace%>" %> -<%%@ Assembly Name="<%=DALNameSpace%>" %> -<%%@ Assembly Name="<%=DALNameSpace+".SqlClient"%>" %> - - -using System; -using System.Data; -using System.Web.Services; -using <%=BLLNameSpace%>; -using <%=DALNameSpace%>; -using <%=DALNameSpace+".SqlClient"%>; - - - -/// -/// Exposes CRUD webmethods for the <%=ClassName%> Database. -/// -[WebService(Namespace="<%=WebServiceUrl%>", Description="Exposes CRUD webmethods for the <%=ClassName%> Database.")] -public class <%=ClassName%> : WebService -{ - <% - System.Collections.ArrayList methods = new System.Collections.ArrayList(); - for (int tableIndex = 0; tableIndex < SourceTables.Count; tableIndex++) - { - // point to the current table - SchemaExplorer.TableSchema SourceTable = SourceTables[tableIndex]; - - // True if primary key is AutoGenerated by database. - //bool IsPkeyReadOnly = false; - - // Name of the table being worked on. - string name = SourceTable.Name; - string className = NameSpace + "." + GetClassName(SourceTable.Name); - string collectionClassName = NameSpace + "." + GetCollectionClassName(SourceTable.Name); - - string commandStem = GetCleanName(SourceTable.Name); - string providerName = GetProviderName(SourceTable.Name); - - // Collection of all columns in the table. - ColumnSchemaCollection cols = SourceTable.Columns; - - // Collection of all columns in the table that are not primary keys. - ColumnSchemaCollection nonKeys = SourceTable.NonPrimaryKeyColumns; - - // Collection of all primary key columns. - ColumnSchemaCollection keys = SourceTable.PrimaryKey.MemberColumns; - - // Collection of ForeignKeys. Provides information about the foreign keys - //(keys where the current table is the foreign table) contained in the table. - TableKeySchemaCollection fkeys = SourceTable.ForeignKeys; - - //Provides information about the primary keys - //(keys where the current table is the primary table) contained in the table. - TableKeySchemaCollection pkeys = SourceTable.PrimaryKeys; - - //Provides information about the indexes contained in the table. - IndexSchemaCollection indexes = SourceTable.Indexes; - - //the first of potentially multiple primary keys - //ColumnSchema primaryKey = keys[0]; - - - // Holds the RowVersion column if there's any - ColumnSchema RowVersion = null; - - foreach (ColumnSchema column in cols) - { - if (column.NativeType.ToLower() == "timestamp") - RowVersion = column; - } - - // this array store each Get BY MemberColumns in order to avoid to create doublon Get methods - System.Collections.ArrayList getbyKeys = new System.Collections.ArrayList(); -%> - - - <% if(IncludeManyToMany) { %> - #region Get from Many To Many Relationship Functions - <% - TableSchema primaryTable = SourceTable; - - foreach(TableKeySchema key in SourceTable.PrimaryKeys) - { - // Check that the key is related to a junction table and that this key relate a PK in this junction table - if ( IsJunctionTable(key.ForeignKeyTable) && IsJunctionKey(key)) - { - TableSchema junctionTable = key.ForeignKeyTable; - - // Search for the other(s) key(s) of the junction table' primary key - foreach(TableKeySchema junctionTableKey in junctionTable.ForeignKeys) - { - if ( IsJunctionKey(junctionTableKey) && junctionTableKey.Name != key.Name ) - { - TableSchema secondaryTable = junctionTableKey.PrimaryKeyTable; - string functionname = GetManyToManyName(junctionTableKey, GetCleanName(junctionTable.Name)); - methods.Add(providerName + "_GetBy" + functionname); -%> - - #region GetBy<%=functionname%> - - [WebMethod(Description="Get rows from the table <%=SourceTable.Name%>, through the junction table <%=junctionTable.Name%>.")] - public <%=NameSpace + "." + GetCollectionClassName(primaryTable.Name)%> <%=providerName%>_GetBy<%=functionname%>(<%=GetFunctionHeaderParameters(junctionTableKey.ForeignKeyMemberColumns)%>, int start, int pageLength, out int count) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.GetBy<%=functionname%>(<%=GetFunctionCallParameters(junctionTableKey.ForeignKeyMemberColumns)%>, start, pageLength, out count); - } - - #endregion GetBy<%=functionname%> - - <% - } //end if there is many to many relationship. - } //end foreach - }// end if(IsJunctionTable(junctionTableKeyForeignKeyTable)) %> - <%}//end foreach pkey %> - #endregion - <% } %> - - <% if (IncludeDelete) { - methods.Add(providerName + "_" + MethodNames.Delete); - %> - #region <%= MethodNames.Delete %> Functions - - /// - /// Deletes a row from the DataSource. - /// - <% for (int i = 0; i < keys.Count; i++) { %> - /// <%= GetColumnXmlComment(keys[i],1)%>. Primary Key. - <% } %> - /// object - /// Connection string to datasource. - /// Deletes based on primary key(s). - /// Returns true if operation suceeded. - [WebMethod(Description="Delete a row from the table <%=SourceTable.Name%>.")] - public bool <%=providerName%>_<%= MethodNames.Delete %>(<%= GetFunctionHeaderParameters(keys) %><% if(RowVersion != null) {Response.Write(", byte[] " + GetPrivateName(RowVersion));}%>) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.Delete %>(<%= GetFunctionCallParameters(keys) %><% if(RowVersion != null) {Response.Write(", " + GetPrivateName(RowVersion));}%>); - } - - #endregion - <% } %> - - <% if (IncludeFind) { - methods.Add(providerName + "_" + MethodNames.Find); - %> - #region <%= MethodNames.Find %> Methods - - /// - /// Returns rows meeting the whereclause condition from the DataSource. - /// - /// Specifies the condition for the rows returned by a query. - /// - /// Returns a DataSet. - [WebMethod(Description="Get rows from the table <%=SourceTable.Name%> with additional query text.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.Find %>(string whereClause, int start, int pageLength, out int count) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.Find %>((TransactionManager) null, whereClause, start, pageLength, out count); - } - - #endregion <%= MethodNames.Find %> Methods - <% } %> - - - <% if (IncludeGetList) { - methods.Add(providerName + "_" + MethodNames.GetAll); - methods.Add(providerName + "_" + MethodNames.GetPaged); - %> - #region <%= MethodNames.GetAll %> Methods - - /// - /// Gets All rows from the DataSource. - /// - /// Row number at which to start reading. - /// Number of rows to return. - /// Number of rows in the DataSource. - /// Returns a DataSet. - [WebMethod(Description="Get all rows from the table <%=SourceTable.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.GetAll %>(int start, int pageLength, out int count) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.GetAll %>(start, pageLength, out count); - } - - #endregion - - #region <%= MethodNames.GetPaged %> Methods - - /// - /// Gets a page of rows from the DataSource. - /// - /// Row number at which to start reading. - /// Number of rows to return. - /// Specifies the condition for the rows returned by a query (Name='John Doe', Name='John Doe' AND Id='1', Name='John Doe' OR Id='1'). - /// Specifies the sort criteria for the rows in the DataSource (Name ASC; BirthDay DESC, Name ASC); - /// Number of rows in the DataSource. - /// - /// Returns a typed collection of <%=ClassName%> objects. - [WebMethod(Description="Get all rows from the table <%=SourceTable.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.GetPaged %>(string whereClause, string orderBy, int start, int pageLength, out int count) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.GetPaged %>(whereClause, orderBy, start, pageLength, out count); - } - - #endregion - <% } %> - - <% if (IncludeGetListByFK) { %> - #region Get By Foreign Key Functions -<% - for (int j=0; j < fkeys.Count;j++) - { - if(IsForeignKeyCoveredByIndex(fkeys[j])) - continue; - - getbyKeys.Add(GetKeysName(fkeys[j].ForeignKeyMemberColumns)); - methods.Add(providerName + "_GetBy" + GetKeysName(fkeys[j].ForeignKeyMemberColumns)); -%> - - /// - /// Gets rows from the datasource based on the <%=fkeys[j].Name%> key. - /// <%=fkeys[j].Name%> Description: <%=GetColumnXmlComment(fkeys[j],1)%> - /// - /// Row number at which to start reading. - /// Number of rows to return. -<% for (int i = 0; i < fkeys[j].ForeignKeyMemberColumns.Count; i++) { %> - /// <%=GetColumnXmlComment(fkeys[j].ForeignKeyMemberColumns[i],1)%> -<% } %> - /// out parameter to get total records for query - /// - /// Returns a DataSet. - [WebMethod(Description="Get rows from <%=SourceTable.Name%> filtered by the <%=GetKeysName(fkeys[j].ForeignKeyMemberColumns)%> column.")] - public <%=collectionClassName%> <%=providerName%>_GetBy<%=GetKeysName(fkeys[j].ForeignKeyMemberColumns)%>(<%= GetFunctionHeaderParameters(fkeys[j].ForeignKeyMemberColumns) %>, int start, int pageLength, out int count) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.GetBy<%=GetKeysName(fkeys[j].ForeignKeyMemberColumns)%>(<%= GetFunctionCallParameters(fkeys[j].ForeignKeyMemberColumns) %>, start, pageLength, out count); - } - -<% }//endfor %> -#endregion - <% } %> - - <% if (IncludeGetListByIX) { %> - #region Get By Index Functions - <% - for (int j=0; j < indexes.Count;j++) - { - // Check if this key is not already generated - if(getbyKeys.IndexOf(GetKeysName(indexes[j].MemberColumns)) >=0 ) - { - continue; - } - else - { - // add this key to the index list - getbyKeys.Add(GetKeysName(indexes[j].MemberColumns)); - } - - string returnType = collectionClassName; - bool isUnique = false; - - if (indexes[j].IsUnique || indexes[j].IsPrimaryKey) - { - returnType = className; - isUnique = true; - } - - methods.Add(providerName + "_GetBy" + GetKeysName(indexes[j].MemberColumns)); - -%> - - /// - /// Gets rows from the datasource based on the <%=indexes[j].Name%> index. - /// - /// Row number at which to start reading. - /// Number of rows to return. -<% for (int i = 0; i < indexes[j].MemberColumns.Count; i++) { %> - /// <%= GetColumnXmlComment(indexes[j].MemberColumns[i],1)%> -<% } %> - /// out parameter to get total records for query - /// Returns a DataSet. - [WebMethod(Description="Get rows from the table <%=SourceTable.Name%> filtered by the column <%=GetKeysName(indexes[j].MemberColumns)%> that is part of the <%=indexes[j].Name%> index.")] - public <%=returnType%> <%=providerName%>_GetBy<%=GetKeysName(indexes[j].MemberColumns)%>(<%= GetFunctionHeaderParameters(indexes[j].MemberColumns) %>, int start, int pageLength, out int count) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.GetBy<%=GetKeysName(indexes[j].MemberColumns)%>(<%= GetFunctionCallParameters(indexes[j].MemberColumns) %>, start, pageLength, out count); - } - - -<% }//endfor %> - #endregion Get By Index Functions - <% } %> - - <% if (IncludeInsert) { - methods.Add(providerName + "_" + MethodNames.Insert); - %> - #region <%= MethodNames.Insert %> Methods - - /// - /// Inserts an object into the datasource. - /// - /// After inserting into the datasource, the object will be returned - /// to refelect any changes made by the datasource. (ie: identity columns) - /// Returns true if operation is successful. - [WebMethod(Description="Inserts a row in the table <%=SourceTable.Name%>.")] - public <%=className%> <%=providerName%>_<%= MethodNames.Insert %>(<%=className%> entity ) - { - <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.Insert %>(entity); - return entity; - } - - /// - /// Inserts a <%=collectionClassName%> object into the datasource using a transaction. - /// - /// <%=collectionClassName%> object to insert. - /// After inserting into the datasource, the <%=className%> object will be updated - /// to refelect any changes made by the datasource. (ie: identity or computed columns) - /// - /// Returns true if operation is successful. - [WebMethod(Description="Inserts a Bulk set of rows into the table <%=SourceTable.Name%>.")] - public void <%=providerName%>_<%= MethodNames.BulkInsert %>(<%=collectionClassName%> entityList ) - { - <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.BulkInsert %>(entityList); - } - #endregion <%= MethodNames.Insert %> Methods - <% } %> - - <% if (IncludeUpdate) { - methods.Add(providerName + "_" + MethodNames.Update); - %> - #region <%= MethodNames.Update %> Methods - - /// - /// Update an existing row in the datasource. - /// - /// object to update. - /// After updating the datasource, the object will be updated - /// to refelect any changes made by the datasource. (ie: identity columns) - /// Returns true if operation is successful. - [WebMethod(Description="Update a row in the table <%=SourceTable.Name%>.")] - public <%=className%> <%=providerName%>_<%= MethodNames.Update %>(<%=className%> entity) - { - <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.Update %>(entity); - return entity; - } - - #endregion <%= MethodNames.Update %> Methods - <% } %> - - <% if (IncludeCustoms) { %> - #region Custom Methods - -<% - System.Collections.IDictionary procs = GetCustomProcedures(SourceTable); - - foreach(DictionaryEntry item in procs) - { - SchemaExplorer.CommandSchema command = (SchemaExplorer.CommandSchema) item.Value; - string methodName = item.Key.ToString(); - string uniqueMethodName = methodName; - - if (methods.Contains(providerName + "_" + methodName)) - uniqueMethodName = methodName + "Custom"; - - string returnType = GetReturnCustomProcReturnType(CustomNonMatchingReturnType, SourceTable, command); - string returnKeyword = returnType == "void" ? "" : "return "; - if (returnType == "IDataReader") - returnType = "DataSet"; - -%> - - /// - /// This method wrap the <%=command.Name%> stored procedure. - /// - [WebMethod(Description="This method wrap the <%=command.Name%> stored procedure.")] - public <%=returnType%> <%=providerName%>_<%=uniqueMethodName%>(int start, int pageLength <%=TransformStoredProcedureInputsToMethod(true, command.InputParameters) + TransformStoredProcedureOutputsToMethod(true, command.AllOutputParameters)%>) - { - <% if (returnType == "DataSet") { %> - <%= returnKeyword %> <% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %><%=DALNameSpace%>.Utility.ConvertDataReaderToDataSet(<%}%><%=DALNameSpace%>.DataRepository.<%=providerName%>.<%=methodName%>(start, pageLength <%=TransformStoredProcedureInputsToDataAccess(true, command.InputParameters) + TransformStoredProcedureOutputsToDataAccess(true, command.AllOutputParameters)%>)<% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %>)<%}%>; - <% } else { %> - <%= returnKeyword %> <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%=methodName%>(start, pageLength <%=TransformStoredProcedureInputsToDataAccess(true, command.InputParameters) + TransformStoredProcedureOutputsToDataAccess(true, command.AllOutputParameters) %>); - <% } %> - } - -<% - } -%> - - #endregion - <% } %> - -<% } /* END For each DataTable */ %> - - - /* -------------------------------------------------------- - SQL VIEWS - ----------------------------------------------------------- */ - <% foreach(ViewSchema SourceView in SourceViews) - { - - string className = NameSpace + "." + GetClassName(SourceView.Name); - string providerName = GetProviderName(SourceView.Name); - string collectionClassName = NameSpace + "." + GetViewCollectionClassName(SourceView.Name); - - methods.Add(providerName + "_Get"); - %> - - <% if (IncludeGetList) { - methods.Add(providerName + "_GetAll"); - %> - #region <%= MethodNames.GetAll %> Methods - - /// - /// Gets All rows from the DataSource. - /// - /// Returns a DataSet. - [WebMethod(Description="Get all rows from the view <%=SourceView.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.GetAll %>(int start, int pageLength) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.GetAll %>(start, pageLength); - } - - #endregion <%= MethodNames.GetAll %> Methods - <% } %> - - #region <%= MethodNames.Get %> Methods - - /// - /// Gets a page of rows from the DataSource. - /// - /// Specifies the condition for the rows returned by a query. - /// Specifies the ORDER By criteria for the rows in the DataSource. - /// - /// Returns a typed collection of <%=ClassName%> objects. - [WebMethod(Description="Get all rows from the view <%=SourceView.Name%>.")] - public <%=collectionClassName%> <%=providerName%>_<%= MethodNames.Get %>(string whereClause, string orderBy, int start, int pageLength) - { - return <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%= MethodNames.Get %>(whereClause.Length > 0 ? whereClause : null, orderBy.Length > 0 ? orderBy : null, start, pageLength); - } - - #endregion <%= MethodNames.Get %> Methods - - <% if (IncludeCustoms) { %> - #region Custom Methods - -<% - System.Collections.IDictionary procs = GetCustomProcedures(SourceView); - - foreach(DictionaryEntry item in procs) - { - SchemaExplorer.CommandSchema command = (SchemaExplorer.CommandSchema) item.Value; - string methodName = item.Key.ToString(); - - string uniqueMethodName = methodName; - - //can't duplicate method names in webservices - if (methods.Contains(providerName + "_" + methodName)) - continue; - - string returnType = GetReturnCustomProcReturnType(CustomNonMatchingReturnType, SourceView, command); - string returnKeyword = returnType == "void" ? "" : "return "; - if (returnType == "IDataReader") - returnType = "DataSet"; -%> - - /// - /// This method wrap the <%=command.Name%> stored procedure. - /// - [WebMethod(Description="This method wrap the <%=command.Name%> stored procedure.")] - public <%=returnType%> <%=providerName%>_<%=methodName%>(int start, int pageLength <%=TransformStoredProcedureInputsToMethod(true, command.InputParameters)%>) - { - <% if (returnType == "DataSet") { %> - //<%= returnKeyword %> <% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %><%=DALNameSpace%>.Utility.ConvertDataReaderToDataSet(<%}%><%=DALNameSpace%>.DataRepository.<%=providerName%>.<%=methodName%>(start, pageLength <%=TransformStoredProcedureInputsToDataAccess(true, command.InputParameters) + TransformStoredProcedureOutputsToDataAccess(true, command.AllOutputParameters)%>)<% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %>)<%}%>; - <%= returnKeyword %> <% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %><%=DALNameSpace%>.Utility.ConvertDataReaderToDataSet(<%}%><%=DALNameSpace%>.DataRepository.<%=providerName%>.<%=methodName%>(start, pageLength <%=TransformStoredProcedureInputsToDataAccess(true, command.InputParameters) %>)<% if (CustomNonMatchingReturnType.ToString() == "IDataReader" ) { %>)<%}%>; - <% } else { %> - <%= returnKeyword %> <%=DALNameSpace%>.DataRepository.<%=providerName%>.<%=methodName%>(start, pageLength <%=TransformStoredProcedureInputsToDataAccess(true, command.InputParameters)%>); - <% } %> - - } -<% - } // foreach command -%> - - #endregion - <% } %> - -<% } %> - - #region General data access methods - - #region ExecuteNonQuery - /// - /// Executes the non query. - /// - /// Name of the stored procedure. - /// The parameter values. - /// - [WebMethod(MessageName="ExecuteNonQueryPs", Description="This method wrap the ExecuteNonQuery method provided by the Enterprise Library Data Access Application Block.")] - public int ExecuteNonQuery(string storedProcedureName, params object[] parameterValues) - { - return <%=DALNameSpace%>.DataRepository.Provider.ExecuteNonQuery(storedProcedureName, parameterValues); - } - - /* - /// - /// Executes the non query. - /// - /// The command wrapper. - [WebMethod(MessageName="ExecuteNonQueryCmd", Description="This method wrap the ExecuteNonQuery method provided by the Enterprise Library Data Access Application Block.")] - public void ExecuteNonQuery(Microsoft.Practices.EnterpriseLibrary.Data.DBCommandWrapper commandWrapper) - { - <%=DALNameSpace%>.DataRepository.Current.ExecuteNonQuery(commandWrapper); - } - */ - - /// - /// Executes the non query. - /// - /// Type of the command. - /// The command text. - /// - [WebMethod(MessageName="ExecuteNonQueryQry", Description="This method wrap the ExecuteNonQuery method provided by the Enterprise Library Data Access Application Block.")] - public int ExecuteNonQuery(CommandType commandType, string commandText) - { - return <%=DALNameSpace%>.DataRepository.Provider.ExecuteNonQuery(commandType, commandText); - } - - #endregion - - #region ExecuteDataSet - /// - /// Executes the data set. - /// - /// Name of the stored procedure. - /// The parameter values. - /// - [WebMethod(MessageName="ExecuteDataSetPs", Description="This method wrap the ExecuteDataSet method provided by the Enterprise Library Data Access Application Block.")] - public DataSet ExecuteDataSet(string storedProcedureName, params object[] parameterValues) - { - return <%=DALNameSpace%>.DataRepository.Provider.ExecuteDataSet(storedProcedureName, parameterValues); - } - - /* - /// - /// Executes the data set. - /// - /// The command wrapper. - /// - [WebMethod(MessageName="ExecuteDataSetCmd", Description="This method wrap the ExecuteDataSet method provided by the Enterprise Library Data Access Application Block.")] - public DataSet ExecuteDataSet(Microsoft.Practices.EnterpriseLibrary.Data.DBCommandWrapper commandWrapper) - { - return <%=DALNameSpace%>.DataRepository.Current.ExecuteDataSet(commandWrapper); - } - */ - - /// - /// Executes the data set. - /// - /// Type of the command. - /// The command text. - /// - [WebMethod(MessageName="ExecuteDataSetQry", Description="This method wrap the ExecuteDataSet method provided by the Enterprise Library Data Access Application Block.")] - public DataSet ExecuteDataSet(CommandType commandType, string commandText) - { - return <%=DALNameSpace%>.DataRepository.Provider.ExecuteDataSet(commandType, commandText); - } - #endregion - - #region ExecuteScalar - /// - /// Executes the scalar. - /// - /// Name of the stored procedure. - /// The parameter values. - /// - [WebMethod(MessageName="ExecuteScalarPs", Description="This method wrap the ExecuteScalar method provided by the Enterprise Library Data Access Application Block.")] - public object ExecuteScalar(string storedProcedureName, params object[] parameterValues) - { - return <%=DALNameSpace%>.DataRepository.Provider.ExecuteScalar(storedProcedureName, parameterValues); - } - - /* - /// - /// Executes the scalar. - /// - /// The command wrapper. - /// - [WebMethod(MessageName="ExecuteScalarCmd", Description="This method wrap the ExecuteScalar method provided by the Enterprise Library Data Access Application Block.")] - public object ExecuteScalar(Microsoft.Practices.EnterpriseLibrary.Data.DBCommandWrapper commandWrapper) - { - return <%=DALNameSpace%>.DataRepository.Current.ExecuteScalar(commandWrapper); - } - */ - - /// - /// Executes the scalar. - /// - /// Type of the command. - /// The command text. - /// - [WebMethod(MessageName="ExecuteScalarQry", Description="This method wrap the ExecuteScalar method provided by the Enterprise Library Data Access Application Block.")] - public object ExecuteScalar(CommandType commandType, string commandText) - { - return <%=DALNameSpace%>.DataRepository.Provider.ExecuteScalar(commandType, commandText); - } - - #endregion - - #endregion -} \ No newline at end of file Index: Source/NetTiers.cst =================================================================== --- Source/NetTiers.cst (revision 552) +++ Source/NetTiers.cst (working copy) @@ -681,6 +681,7 @@ string DALWSNameSpace = DALNameSpace + ".WebServiceClient"; string UTNameSpace = NameSpace + "." + (UnitTestsNameSpace.Length>0 ? GetCleanName2(UnitTestsNameSpace) : "UnitTests"); string WSNameSpace = DALNameSpace + ".WebService"; + string WSNameSpaceImpl = NameSpace + "Services.Implementation"; string WebLibNameSpace = NameSpace + ".Web"; string WebsiteNameSpace = NameSpace + ".Website"; string WinLibNameSpace = NameSpace + ".Windows.Forms"; @@ -702,7 +703,8 @@ string rootPathUT = OutputDirectory + "\\" + UTNameSpace; string rootPathSQL = OutputDirectory + "\\" + SQLNamespace; - string rootPathWS = WebServiceOutputPath; + string rootPathWS = WebServiceOutputPath; + string rootPathWSImpl = WebServiceOutputPath + ".Implementation"; string specialPath = vsnetIntegration == VSNetIntegration.SeparatedProjects ? ((IncludeUnitTest != MoM.Templates.UnitTestStyle.None) ? rootPathUT : rootPathDAL) : OutputDirectory; bool HasCustomCode = (CustomCodeFolderName != null && CustomCodeFolderName.Trim().Length > 0 ); @@ -1003,6 +1005,7 @@ if (GenerateWebservice) { SafeCreateDirectory(rootPathWS); + SafeCreateDirectory(rootPathWSImpl); SafeCreateDirectory(rootPathWS + "\\Bin"); if ( HasCustomCode ) @@ -1803,63 +1806,94 @@ { if (this.IncludeComponentLayer == MoM.Templates.ComponentPatternType.ServiceLayer) { + if(!File.Exists(rootPathWSImpl + "\\" + GetClassName(SourceDatabase.Name) + "BLLServices.cs")) + { + AddFileNode(commonNode, GetClassName(SourceDatabase.Name) + "BLLServices.cs"); + + this.GetTemplate("WebServiceImpl.cst").SetProperty("NameSpace", NameSpace); + this.GetTemplate("WebServiceImpl.cst").SetProperty("WebServiceUrl", WebServiceUrl); + this.GetTemplate("WebServiceImpl.cst").SetProperty("ClassName", GetClassName(SourceDatabase.Name) + "BLLServices"); + + this.RenderToFile("WebServiceImpl.cst", rootPathWSImpl + "\\" + GetClassName(SourceDatabase.Name) + "BLLServices.cs", false); + } //ComponentService Layer AddFileNode(commonNode, SourceDatabase.Name + "BLLServices.asmx"); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("SourceViews", templateSourceViews); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("SourceTables", templateSourceTables); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeCustoms", IncludeCustoms); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("CustomNonMatchingReturnType", CustomNonMatchingReturnType); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("ProcedurePrefix", ProcedurePrefix.Replace(" ", "")); + this.GetTemplate("WebService.cst").SetProperty("ClassName", NameSpace + "Services.Implementation." + GetClassName(SourceDatabase.Name) + "BLLServices"); + this.RenderToFile("WebService.cst", rootPathWS + "\\" + GetClassName(SourceDatabase.Name) + "BLLServices.asmx", true); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeInsert", IncludeInsert); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeUpdate", IncludeUpdate); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeDelete", IncludeDelete); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeUpdate", IncludeUpdate); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeManyToMany", IncludeManyToMany); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeGetList", IncludeGetList); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeGetListByFK", IncludeGetListByFK); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeGetListByIX", IncludeGetListByIX); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("IncludeFind", IncludeFind); + AddFileNode(commonNode, GetClassName(SourceDatabase.Name) + "BLLServices.generated.cs"); + + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("SourceViews", templateSourceViews); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("SourceTables", templateSourceTables); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeCustoms", IncludeCustoms); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("CustomNonMatchingReturnType", CustomNonMatchingReturnType); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("ProcedurePrefix", ProcedurePrefix.Replace(" ", "")); + + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeInsert", IncludeInsert); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeUpdate", IncludeUpdate); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeDelete", IncludeDelete); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeUpdate", IncludeUpdate); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeManyToMany", IncludeManyToMany); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeGetList", IncludeGetList); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeGetListByFK", IncludeGetListByFK); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeGetListByIX", IncludeGetListByIX); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("IncludeFind", IncludeFind); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("NameSpace", BLLNameSpace); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("ComponentsNameSpace", ComponentsNameSpace); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("BLLNameSpace", BLLNameSpace); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("NameSpace", BLLNameSpace); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("ComponentsNameSpace", ComponentsNameSpace); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("BLLNameSpace", BLLNameSpace); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("ClassName", GetClassName(SourceDatabase.Name) + "Services"); - this.GetTemplate("ServiceLayer.WebService.cst").SetProperty("WebServiceUrl", WebServiceUrl); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("ClassName", GetClassName(SourceDatabase.Name) + "BLLServicesBase"); + this.GetTemplate("ServiceLayer.WebServiceBaseImpl.cst").SetProperty("WebServiceUrl", WebServiceUrl); - this.RenderToFile("ServiceLayer.WebService.cst", rootPathWS + "\\" + GetClassName(SourceDatabase.Name) + "BLLServices.asmx", true); + this.RenderToFile("ServiceLayer.WebServiceBaseImpl.cst", rootPathWSImpl + "\\" + GetClassName(SourceDatabase.Name) + "BLLServices.generated.cs", true); } //End ComponentService Layer AddFileNode(commonNode, SourceDatabase.Name + "Services.asmx"); + + this.GetTemplate("WebService.cst").SetProperty("ClassName", NameSpace + "Services.Implementation." + GetClassName(SourceDatabase.Name) + "Services"); - this.GetTemplate("WebService.cst").SetProperty("SourceViews", templateSourceViews); - this.GetTemplate("WebService.cst").SetProperty("SourceTables", templateSourceTables); - this.GetTemplate("WebService.cst").SetProperty("IncludeCustoms", IncludeCustoms); - this.GetTemplate("WebService.cst").SetProperty("CustomNonMatchingReturnType", CustomNonMatchingReturnType); - this.GetTemplate("WebService.cst").SetProperty("ProcedurePrefix", ProcedurePrefix.Replace(" ", "")); + this.RenderToFile("WebService.cst", rootPathWS + "\\" + GetClassName(SourceDatabase.Name) + "Services.asmx", true); - this.GetTemplate("WebService.cst").SetProperty("IncludeInsert", IncludeInsert); - this.GetTemplate("WebService.cst").SetProperty("IncludeUpdate", IncludeUpdate); - this.GetTemplate("WebService.cst").SetProperty("IncludeDelete", IncludeDelete); - this.GetTemplate("WebService.cst").SetProperty("IncludeUpdate", IncludeUpdate); - this.GetTemplate("WebService.cst").SetProperty("IncludeManyToMany", IncludeManyToMany); - this.GetTemplate("WebService.cst").SetProperty("IncludeGetList", IncludeGetList); - this.GetTemplate("WebService.cst").SetProperty("IncludeGetListByFK", IncludeGetListByFK); - this.GetTemplate("WebService.cst").SetProperty("IncludeGetListByIX", IncludeGetListByIX); - this.GetTemplate("WebService.cst").SetProperty("IncludeFind", IncludeFind); + //service implementation + if(!File.Exists(rootPathWSImpl + "\\" + GetClassName(SourceDatabase.Name) + "Services.cs")) + { + AddFileNode(commonNode, GetClassName(SourceDatabase.Name) + "Services.cs"); + + this.GetTemplate("WebServiceImpl.cst").SetProperty("NameSpace", NameSpace); + this.GetTemplate("WebServiceImpl.cst").SetProperty("WebServiceUrl", WebServiceUrl); + this.GetTemplate("WebServiceImpl.cst").SetProperty("ClassName", GetClassName(SourceDatabase.Name) + "Services"); + + this.RenderToFile("WebServiceImpl.cst", rootPathWSImpl + "\\" + GetClassName(SourceDatabase.Name) + "Services.cs", false); + } + + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("SourceViews", templateSourceViews); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("SourceTables", templateSourceTables); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeCustoms", IncludeCustoms); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("CustomNonMatchingReturnType", CustomNonMatchingReturnType); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("ProcedurePrefix", ProcedurePrefix.Replace(" ", "")); + + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeInsert", IncludeInsert); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeUpdate", IncludeUpdate); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeDelete", IncludeDelete); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeUpdate", IncludeUpdate); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeManyToMany", IncludeManyToMany); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeGetList", IncludeGetList); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeGetListByFK", IncludeGetListByFK); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeGetListByIX", IncludeGetListByIX); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("IncludeFind", IncludeFind); - this.GetTemplate("WebService.cst").SetProperty("NameSpace", BLLNameSpace); - this.GetTemplate("WebService.cst").SetProperty("DALNameSpace", DALNameSpace); - this.GetTemplate("WebService.cst").SetProperty("BLLNameSpace", BLLNameSpace); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("NameSpace", NameSpace); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("DALNameSpace", DALNameSpace); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("BLLNameSpace", BLLNameSpace); - this.GetTemplate("WebService.cst").SetProperty("ClassName", GetClassName(SourceDatabase.Name) + "Services"); - this.GetTemplate("WebService.cst").SetProperty("WebServiceUrl", WebServiceUrl); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("ClassName", GetClassName(SourceDatabase.Name) + "ServicesBase"); + this.GetTemplate("WebServiceBaseImpl.cst").SetProperty("WebServiceUrl", WebServiceUrl); - this.RenderToFile("WebService.cst", rootPathWS + "\\" + GetClassName(SourceDatabase.Name) + "Services.asmx", true); + this.RenderToFile("WebServiceBaseImpl.cst", rootPathWSImpl + "\\" + GetClassName(SourceDatabase.Name) + "Services.generated.cs", true); // Writing the web.config of this webservice //AddFileNode(commonNode, "Web.config"); @@ -2365,7 +2399,8 @@ string DALSqlGuid = "8996A7B4-57D3-440B-A545-A701844B8C4A"; //Guid.NewGuid().ToString(); string DALWSGuid = "061C1BBE-0BFB-4D45-8125-9AB0BBC09A92"; //Guid.NewGuid().ToString(); string DALGenericGuid = "6788B7D9-57D3-440B-A545-A701844B8C4A"; //Guid.NewGuid().ToString(); - string wsGuid = "5E3CA58E-216A-4F53-BD23-5A48A6C44924"; //Guid.NewGuid().ToString(); + string wsGuid = "5E3CA58E-216A-4F53-BD23-5A48A6C44924"; + string wsImplGuid = "6B94DC6A-75AA-4584-AEAB-AB1D8F7B2616"; string utGuid = "031D5BAE-0BFB-4D45-8125-9AB0BBC09A92"; //Guid.NewGuid().ToString(); string webLibGuid = "47FE3BE8-3E46-47CA-8494-473755867DD0"; //Guid.NewGuid().ToString(); string websiteGuid = "1DCAB031-308A-4581-AFA8-BD29F45A1357"; @@ -2392,6 +2427,7 @@ this.GetTemplate(solutionTemplate).SetProperty("DALGenericNameSpace", DALGenericNameSpace); this.GetTemplate(solutionTemplate).SetProperty("DALWSNameSpace", DALWSNameSpace); this.GetTemplate(solutionTemplate).SetProperty("WebLibNameSpace", WebLibNameSpace); + this.GetTemplate(solutionTemplate).SetProperty("WSNameSpaceImpl", WSNameSpaceImpl); this.GetTemplate(solutionTemplate).SetProperty("WinLibNameSpace", WinLibNameSpace); this.GetTemplate(solutionTemplate).SetProperty("WebsiteNameSpace", WebsiteNameSpace); this.GetTemplate(solutionTemplate).SetProperty("UTNameSpace", UTNameSpace); @@ -2403,6 +2439,7 @@ this.GetTemplate(solutionTemplate).SetProperty("DALGenericGuid", DALGenericGuid); this.GetTemplate(solutionTemplate).SetProperty("DALWSGuid", DALWSGuid); this.GetTemplate(solutionTemplate).SetProperty("WSGuid", wsGuid); + this.GetTemplate(solutionTemplate).SetProperty("WSImplGuid", wsImplGuid); this.GetTemplate(solutionTemplate).SetProperty("UTGuid", utGuid); this.GetTemplate(solutionTemplate).SetProperty("WebLibGuid", webLibGuid); this.GetTemplate(solutionTemplate).SetProperty("WebsiteGuid", websiteGuid); @@ -2475,6 +2512,7 @@ this.GetTemplate(projectTemplate).SetProperty("WebsiteNameSpace", WebsiteNameSpace); this.GetTemplate(projectTemplate).SetProperty("UTNameSpace", UTNameSpace); this.GetTemplate(projectTemplate).SetProperty("WSNameSpace", WSNameSpace); + this.GetTemplate(projectTemplate).SetProperty("WSNameSpaceImpl", WSNameSpace); this.GetTemplate(projectTemplate).SetProperty("NetTiersTemplatePath", string.Empty); this.GetTemplate(projectTemplate).SetProperty("PropertySetFilePath", string.Empty); @@ -2639,6 +2677,7 @@ this.GetTemplate(projectTemplate).SetProperty("IncludeSqlClient", false); this.GetTemplate(projectTemplate).SetProperty("IncludeGenericClient", false); this.GetTemplate(projectTemplate).SetProperty("IncludeWebservice", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeWebserviceImpl", false); this.GetTemplate(projectTemplate).SetProperty("IncludeWebserviceClient", true); this.GetTemplate(projectTemplate).SetProperty("IncludeComponents", false); this.GetTemplate(projectTemplate).SetProperty("IncludeWebLibrary", false); @@ -2649,6 +2688,27 @@ //this.GetTemplate(projectTemplate).RenderToFile(rootPathDALWS + "\\" + DALWSNameSpace + ".csproj", true); this.RenderToFile(projectTemplate, rootPathDALWS + "\\" + DALWSNameSpace + ".csproj", true); + + //webservice implementation + AddFileNode(commonNode, rootPathWSImpl + ".csproj"); + + this.GetTemplate(projectTemplate).SetProperty("IncludeBll", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeDALBase", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeSqlClient", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeGenericClient", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeWebservice", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeWebserviceImpl", true); + this.GetTemplate(projectTemplate).SetProperty("IncludeWebserviceClient", false); + this.GetTemplate(projectTemplate).SetProperty("NetTiersSqlProvider", _netTiersSqlProvider); + this.GetTemplate(projectTemplate).SetProperty("IncludeComponents", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeWebLibrary", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeWebsite", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeUnitTest", MoM.Templates.UnitTestStyle.None); + this.GetTemplate(projectTemplate).SetProperty("IncludeWCFDataAttributes", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeDesignTimeSupport", false); + + this.RenderToFile(projectTemplate, rootPathWSImpl + "\\" + WSNameSpaceImpl + ".csproj", true); + } } @@ -2684,6 +2744,7 @@ this.GetTemplate(projectTemplate).SetProperty("IncludeSqlClient", false); this.GetTemplate(projectTemplate).SetProperty("IncludeGenericClient", false); this.GetTemplate(projectTemplate).SetProperty("IncludeWebservice", false); + this.GetTemplate(projectTemplate).SetProperty("IncludeWebserviceImpl", false); this.GetTemplate(projectTemplate).SetProperty("IncludeWebserviceClient", false); this.GetTemplate(projectTemplate).SetProperty("IncludeComponents", false); this.GetTemplate(projectTemplate).SetProperty("IncludeWebLibrary", true); Index: Source/TemplateLib/CreateTemplates.cs =================================================================== --- Source/TemplateLib/CreateTemplates.cs (revision 552) +++ Source/TemplateLib/CreateTemplates.cs (working copy) @@ -131,7 +131,10 @@ CodeTemplates.Add("ServiceLayer.WebService.cst", base.CreateTemplate()); this.PerformStep(); + CodeTemplates.Add("ServiceLayer.WebServiceBaseImpl.cst", base.CreateTemplate()); this.PerformStep(); CodeTemplates.Add("WebService.cst", base.CreateTemplate()); this.PerformStep(); + CodeTemplates.Add("WebServiceBaseImpl.cst", base.CreateTemplate()); this.PerformStep(); + CodeTemplates.Add("WebServiceImpl.cst", base.CreateTemplate()); this.PerformStep(); CodeTemplates.Add("WebInfo.cst", base.CreateTemplate()); this.PerformStep(); CodeTemplates.Add("WsNetTiersProvider.cst", base.CreateTemplate()); this.PerformStep(); Index: Source/TemplateLib/FrameworkTemplates.cst =================================================================== --- Source/TemplateLib/FrameworkTemplates.cst (revision 552) +++ Source/TemplateLib/FrameworkTemplates.cst (working copy) @@ -129,7 +129,10 @@ <%@ Register Name="ServiceLayerWebService" Template="../DataAccessLayer.WebService/ServiceLayer.WebService.cst" MergeProperties="False" ExcludeProperties="" %> +<%@ Register Name="ServiceLayerWebServiceImpl" Template="../DataAccessLayer.WebService/ServiceLayer.WebServiceBaseImpl.cst" MergeProperties="False" ExcludeProperties="" %> <%@ Register Name="WebService" Template="../DataAccessLayer.WebService/WebService.cst" MergeProperties="False" ExcludeProperties="" %> +<%@ Register Name="WebServiceBaseImpl" Template="../DataAccessLayer.WebService/WebServiceBaseImpl.cst" MergeProperties="False" ExcludeProperties="" %> +<%@ Register Name="WebServiceImpl" Template="../DataAccessLayer.WebService/WebServiceImpl.cst" MergeProperties="False" ExcludeProperties="" %> <%@ Register Name="WebInfo" Template="../DataAccessLayer.WebService/WebInfo.cst" MergeProperties="False" ExcludeProperties="" %> <%@ Register Name="WsNetTiersProvider" Template="../DataAccessLayer.WebServiceClient/WsNetTiersProvider.cst" MergeProperties="False" ExcludeProperties="" %> Index: Source/VisualStudio/vsnet2005.project.cst =================================================================== --- Source/VisualStudio/vsnet2005.project.cst (revision 552) +++ Source/VisualStudio/vsnet2005.project.cst (working copy) @@ -27,6 +27,7 @@ <%@ Property Name="DALWSNameSpace" Type="System.String" Category="Data" Description="DAL ws Namespace." %> <%@ Property Name="UTNameSpace" Type="System.String" Category="Data" Description="UT Namespace." %> <%@ Property Name="WSNameSpace" Type="System.String" Category="Data" Description="WebService Namespace." %> +<%@ Property Name="WSNameSpaceImpl" Type="System.String" Category="Data" Description="WebService Implementation Namespace." %> <%@ Property Name="WebLibNameSpace" Type="System.String" Category="Data" Description="Web Library Namespace." %> <%@ Property Name="WebsiteNameSpace" Type="System.String" Category="Data" Description="Website Namespace." %> <%@ Property Name="ComponentLayerNameSpace" Type="System.String" Category="Data" Description="Component Layer Namespace." %> @@ -45,6 +46,8 @@ <%@ Property Name="IncludeWebLibrary" Type="System.Boolean" Category="Option" Description="" %> <%@ Property Name="IncludeWebsite" Type="System.Boolean" Category="Option" Description="" %> <%@ Property Name="IncludeWebservice" Type="System.Boolean" Category="Option" Description="" %> +<%@ Property Name="IncludeWebserviceImpl" Type="System.Boolean" Category="Option" Description="" %> + <%@ Property Name="IncludeComponents" Type="System.Boolean" Category="Option" Description="Determines whether or not a component library is being used." %> <%@ Property Name="IncludeWebserviceClient" Type="System.Boolean" Category="Option" Description="" %> <%@ Property Name="IncludeUnitTest" Type="MoM.Templates.UnitTestStyle" Default="NUnit" Category="General" Description="Indicates type of Unit tests to be generated." %> @@ -98,6 +101,10 @@ { fileName = WSNameSpace; } + else if (IncludeWebserviceImpl) + { + fileName = WSNameSpaceImpl; + } else if (IncludeWebserviceClient) { fileName = DALWSNameSpace; @@ -257,59 +264,59 @@ %> False - ..\References\Microsoft.Practices.EnterpriseLibrary.Common.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Common.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.Caching.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Caching.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Caching.Cryptography.dll False - ..\References\Microsoft.Practices.ObjectBuilder.dll + ..\Lib\Microsoft.Practices.ObjectBuilder.dll <% if (IncludeComponents || IncludeWebsite){%> False - ..\References\Microsoft.Practices.EnterpriseLibrary.Logging.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Logging.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.Logging.Database.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Logging.Database.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.Security.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Security.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll <%}%> <% } // END If IncludeBLL || IncludeComponents else if (IncludeDALBase || IncludeSqlClient || IncludeGenericClient || IncludeWebserviceClient) {%> False - ..\References\Microsoft.Practices.EnterpriseLibrary.Common.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Common.dll False - ..\References\Microsoft.Practices.EnterpriseLibrary.Data.dll + ..\Lib\Microsoft.Practices.EnterpriseLibrary.Data.dll False - ..\References\Microsoft.Practices.ObjectBuilder.dll + ..\Lib\Microsoft.Practices.ObjectBuilder.dll <%}%> <% if ( IncludeWebsite && IncludeAtlasLibrary ) { %> @@ -318,11 +325,11 @@ <% if ( IncludeWebsite && IncludeAtlasToolkit ) { %> False - ..\References\AjaxControlToolkit.dll + ..\..\Reference Libraries\Microsoft\Ajax\AjaxControlToolkit.dll False - ..\References\AJAXExtensionsToolbox.dll + ..\..\Reference Libraries\Microsoft\Ajax\AJAXExtensionsToolbox.dll <% } %> @@ -334,7 +341,7 @@ <%}%> - <% if (IncludeSqlClient || IncludeGenericClient || IncludeWebserviceClient || IncludeWebLibrary) { %> + <% if (IncludeSqlClient || IncludeGenericClient || IncludeWebserviceClient || IncludeWebLibrary || IncludeWebserviceImpl) { %> <%=DALNameSpace%> {<%=DALGuid%>} @@ -342,7 +349,7 @@ <% } %> - <% if (IncludeWebservice || IncludeComponents || IncludeWebsite) { %> + <% if (IncludeWebservice || IncludeComponents || IncludeWebsite || IncludeWebserviceImpl) { %> <%=DALNameSpace%> {<%=DALGuid%>} @@ -425,6 +432,19 @@ <%}%> + <% if (IncludeWebserviceImpl) { %> + + System.Web.Services + + <% if (ComponentPattern == MoM.Templates.ComponentPatternType.ServiceLayer) { %> + + <%=ComponentLayerNameSpace%> + {<%=ComponentsGuid%>} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + + <%}%> + <%}%> + <% if ((IncludeUnitTest != MoM.Templates.UnitTestStyle.None) || IncludeWebservice) {%> @@ -660,6 +680,26 @@ Code + + <% if (IncludeWebserviceImpl) { %> + + Code + + + <%=NameSpace%>Services.cs + Code + + <% } %> + + <% if (IncludeWebserviceImpl && ComponentPattern == MoM.Templates.ComponentPatternType.ServiceLayer) { %> + + Code + + + <%=NameSpace%>BLLServices.cs + Code + + <%}%> <% /* Include the IEntity interface. */ %> <% if (IncludeBll) { %> Index: Source/VisualStudio/vsnet2005.solution.cst =================================================================== --- Source/VisualStudio/vsnet2005.solution.cst (revision 552) +++ Source/VisualStudio/vsnet2005.solution.cst (working copy) @@ -11,6 +11,7 @@ <%@ Property Name="DALGenericNameSpace" Type="System.String" Category="Data" Description="DAL sql Namespace." %> <%@ Property Name="DALWSNameSpace" Type="System.String" Category="Data" Description="DAL ws Namespace." %> <%@ Property Name="WebLibNameSpace" Type="System.String" Category="Data" Description="Web Library Namespace." %> +<%@ Property Name="WSNameSpaceImpl" Type="System.String" Category="Data" Description="WebService Implementation Namespace." %> <%@ Property Name="WebsiteNameSpace" Type="System.String" Category="Data" Description="Website Namespace." %> <%@ Property Name="WinLibNameSpace" Type="System.String" Category="Data" Description="Win Library Namespace." %> <%@ Property Name="UTNameSpace" Type="System.String" Category="Data" Description="UT Namespace." %> @@ -23,6 +24,7 @@ <%@ Property Name="ComponentPattern" Default="None" Type="MoM.Templates.ComponentPatternType" Category="Data" Description="Component Layer Pattern Type." %> <%@ Property Name="ComponentsGuid" Type="System.String" Category="Style" Description="Component Project Guid" %> <%@ Property Name="WSGuid" Type="System.String" Category="Context" Description="WS Project Guid" %> +<%@ Property Name="WSImplGuid" Type="System.String" Category="Context" Description="WS Implementation Project Guid" %> <%@ Property Name="UTGuid" Type="System.String" Category="Context" Description="Unit tests Project Guid" %> <%@ Property Name="WebLibGuid" Type="System.String" Category="Context" Description="Web Library Project Guid" %> <%@ Property Name="WebsiteGuid" Type="System.String" Category="Context" Description="Website Project Guid" %> @@ -106,14 +108,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "<%=DALWSNameSpace%>", "<%=DALWSNameSpace%>\<%=DALWSNameSpace%>.csproj", "{<%=DALWSGuid%>}" EndProject <% } %> +<% if (IncludeWebservice) { %> +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "<%=WSNameSpaceImpl%>", "WebServices.Implementation\<%=WSNameSpaceImpl%>.csproj", "{<%=WSImplGuid%>}" +EndProject +<% } %> <% if (IncludeWebservice) { - string componentReference = string.Empty; - if (ComponentPattern == MoM.Templates.ComponentPatternType.ServiceLayer) - componentReference = string.Format("{{{0}}}|{1}.dll;", ComponentsGuid, ComponentLayerNameSpace); + %> Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "<%=WebServiceUrl%>", "<%=WebServiceUrl%>", "{<%=WSGuid%>}" ProjectSection(WebsiteProperties) = preProject - ProjectReferences = "{<%=BLLGuid%>}|<%=BLLNameSpace%>.dll;{<%=DALGuid%>}|<%=DALNameSpace%>.dll;{<% if (IncludeSqlClient) {%><%=DALSqlGuid%>}|<%=DALSqlNameSpace%>.dll<%} else {%><%=DALGenericGuid%>}|<%=DALGenericNameSpace%>.dll<%}%>;<%= componentReference %>" + ProjectReferences = "{<%=WSImplGuid%>}|<%=RootNameSpace%>Services.Implementation.dll;" Debug.AspNetCompiler.PhysicalPath = "<%=rootPathWS%>" Debug.AspNetCompiler.TargetPath = "<%=WebServiceUrl%>" Debug.AspNetCompiler.Updateable = "true" @@ -216,6 +220,10 @@ {<%=WSGuid%>}.Debug|Any CPU.Build.0 = Debug|Any CPU {<%=WSGuid%>}.Release|Any CPU.ActiveCfg = Release|Any CPU {<%=WSGuid%>}.Release|Any CPU.Build.0 = Release|Any CPU + {<%=WSImplGuid%>}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {<%=WSImplGuid%>}.Debug|Any CPU.Build.0 = Debug|Any CPU + {<%=WSImplGuid%>}.Release|Any CPU.ActiveCfg = Release|Any CPU + {<%=WSImplGuid%>}.Release|Any CPU.Build.0 = Release|Any CPU <%}%> <% if (IncludeUnitTest != MoM.Templates.UnitTestStyle.None) { %> {<%=UTGuid%>}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -253,6 +261,7 @@ <%}%> <% if (IncludeWebservice) { %> {<%=WSGuid%>} = {F3A10C8D-3227-449F-A2CB-014DE2D7F415} + {<%=WSImplGuid%>} = {F3A10C8D-3227-449F-A2CB-014DE2D7F415} <%}%> <% if (IncludeUnitTest != MoM.Templates.UnitTestStyle.None) { %> {<%=UTGuid%>} = {F3A10C8D-3227-449F-A2CB-014DE2D7F415}