CodeSmith Community
Your Code. Your Way. Faster!

WebServices Into Partial Classes

Latest post 08-12-2008 9:50 AM by vbandrade. 2 replies.
  • 08-08-2008 7:15 PM

    WebServices Into Partial Classes

    I'm using .netTiers 2.3. I gened the DB and got the Web Services asmx file. It is great! But it's also 23,000 lines of code which makes VS2008 choke, spit and cough. I want to leave the initial asmx file alone and add web methods to a partial class of the service. The problem is that if I navigate to http://localhost/admin/ws/B2BFWServices.asmx, the webmethod in  http://localhost/admin/ws/B2BFWServices2.asmx is missing and vice versa. I have tried eliminating the  http://localhost/admin/ws/B2BFWServices2.asmx file and turning it into  B2BFWServices2.cs. I have also tried removing the WebService Directives from the seconday file to no avail. Everything compiles fine, but the web methods are not shared across the partial class.

     Sample code is below. If anyone can point out the errors of my ways, it would be greatly appreciated.

    Paul

     

     

    B2BFWServices:

    "C#" Class="B2B.Website.B2BFWServices"-->"B2B.Entities"-->"B2B.Data"-->"B2B.Data.SqlClient"-->using B2B.Entities;
    using B2B.Data;
    using B2B.Data.SqlClient;
    using System;
    using System.Web;
    using System.Web.Services; using System.Web.Services.Protocols;
    using System.Data.Sql;
    using System.Data.Common;
    using System.Data;
    using System.Configuration;

    namespace B2B.Website
    {
       
    /// <summary>
    /// Exposes CRUD webmethods for the B2BFWServices Database.
    /// </summary>

    [WebService(Namespace="http://localhost/B2BServices", Description="Exposes CRUD webmethods for the B2BFWServices Database.")]
    public partial class B2BFWServices : WebService
    {
            [WebMethod(Description="
    Get rows from the table UserGroup, through the junction table UserXUserGroup.")]
    public B2B.Entities.TList UserGroupProvider_GetByUserIdFromUserXuserGroup(int _userId, int start, int pageLength, out int count)
    {
    return B2B.Data.DataRepository.UserGroupProvider.GetByUserIdFromUserXuserGroup(_userId, start, pageLength, out count);
    }
    }
    }

     

    B2BFWServices2:

     

    using B2B.Entities;
    using B2B.Data;
    using B2B.Data.SqlClient;
    using System;
    using System.Web;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    using System.Data.Sql;
    using System.Data.Common;
    using System.Data;
    using System.Configuration;
    
    namespace B2B.Website
    {
    
    
        public partial class B2BFWServices : WebService
        {
            /// <summary>
            /// 	Inserts an object into the datasource.
            /// </summary>	
            /// <remarks>After inserting into the datasource, the object will be returned
            /// to refelect any changes made by the datasource. (ie: identity columns)</remarks>
            /// <returns>Returns true if operation is successful.</returns>
            /// , System.Web.Services.Protocols.SoapRpcMethod
            [WebMethod(Description = "Inserts a row in the table UserGroup.")]
            public B2B.Entities.UserGroup UserGroupProvider_Insert(isoUsergroup grp)
            {
                B2B.Entities.UserGroup ug = new UserGroup();
                ug.GroupName = grp.GroupName;
                ug.GroupDesc = grp.GroupDesc;
                ug.DivId = grp.DivID;
                ug.SrsKey = grp.SRSKey;
    
                B2B.Data.DataRepository.UserGroupProvider.Insert(ug);
                return ug;
            }
    
        }
    
    
    
        public class isoUsergroup
        {
            public string GroupName = string.Empty;
            public Int32 UsergroupId = 0;
            public string GroupDesc = string.Empty;
            public string SRSKey = string.Empty;
            public Int32 DivID;
        }
    
    }
     

    • Post Points: 5
  • 08-12-2008 12:36 AM In reply to

    Re: WebServices Into Partial Classes

    Never mind, figured it out. Each of the partial classes need to be in a code behind file. If one is actually in the asmx file, it will not grab the other partial class.

    • Post Points: 35
  • 08-12-2008 9:50 AM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 254
    • Points 6,460

    Re: WebServices Into Partial Classes

    Make sure you really need a webservice, it throws your perfomance out the window. );

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems