Web服务中的抽象类 [英] Abstract class in web service
问题描述
大家好,
如何通过引用该Web服务的项目中的类继承用Web服务类编写的抽象类?
EG:
Web服务类
Hi Everyone,
How can I inherit an abstract class written in a web service class by a class within a project that referenced that web service?
EG:
Web Service Class
[WebService(Namespace = "...")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class AppService : System.Web.Services.WebService
{
public abstract class InheritMe<T>
{
...
}
}
本地类
Local Class
class ConcreteClass : WebService.AppService.InheritMe<int>
{
...
}
拜托,我真的需要帮助.
在此先感谢..
Please, I really need help.
Thanks in advance..
推荐答案
http://forums.asp.net/t/1509177.aspx/1 [ ^ ]
我相信这会对您有所帮助.享受
http://forums.asp.net/t/1509177.aspx/1[^]
I am sure this will help you.Enjoy
出什么问题了?
What''s the problem?
如果您的抽象类声明为以下内容:
If your abstract class is declared as the following:
namespace MyWebServiceNamespace
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class AppService : System.Web.Services.WebService
{
// ...
public abstract class InheritMe<T>
{
// ...
}
// ...
}
}
您可以按以下方式继承它:
you can inherit it as the following:
public class MyClass : MyWebServiceNamespace.AppService.InheritMe<int>
{
}
因为您的类在WebService
中声明,所以您还必须在包含继承您抽象类的类的项目中添加对System.Web.Services
的引用.
Because your class is declared in a WebService
you also have to add a reference to System.Web.Services
, in the project that contains the class that inherits your abstract class.
这篇关于Web服务中的抽象类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!