473,411 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

WCF: How do I attribute a base .NET class ?

I defined a WCF callback contract:
<ServiceContract()_
Interface IEBAPEvents
'this interface defines the events to be triggered in the clients
'the EBAP pattern defines two events: a progress event and a completion
event

<OperationContract(IsOneWay:=True)_
Sub OnProgressChanged(ByVal e As FindFilesProgressChangedEventArgs)

<OperationContract(IsOneWay:=True)_
Sub OnFindFilesCompleted(ByVal e As FindFilesCompletedEventArgs)
End Interface

and the event args:

<DataContract()_
Public Class FindFilesProgressChangedEventArgs
Inherits ProgressChangedEventArgs
...

<DataContract()_
Public Class FindFilesCompletedEventArgs
Inherits AsyncCompletedEventArgs
When starting the WCF host an error message appears:
Error: Type 'System.ComponentModel.ProgressChangedEventArgs' cannot be seria
d. Consider marking it with the DataContractAttribute attribute, and marking
of its members you want serialized with the DataMemberAttribute attribute.

How do I add an attribute to the .NET class ProgressChangedEventArgs ?

thank you very much
herbert
Sep 1 '07 #1
2 1715
Have you tried adding the Serializable attribute?
See example below. You need to "attribute up" both the base class, and
subclass.

using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;

namespace MyCompany.MyApplication
{

[Serializable]
[DataContract]
public class HelpDeskTicketDifficulty
{

[DataMember]
private Guid _helpDeskTicketDifficultyUUID;

[DataMember]
private int _helpDeskTicketDifficultyID;

[DataMember]
private string _helpDeskTicketDifficultyName = string.Empty ;
public HelpDeskTicketDifficulty() { } //unnecessary, but a
placeholder

public HelpDeskTicketDifficulty(System.Guid
helpDeskTicketDifficultyUUID, int helpDeskTicketDifficultyID, string
helpDeskTicketDifficultyName)
{
this._helpDeskTicketDifficultyUUID =
helpDeskTicketDifficultyUUID;
this._helpDeskTicketDifficultyID = helpDeskTicketDifficultyID;
this._helpDeskTicketDifficultyName =
helpDeskTicketDifficultyName;
}
#region A

public Guid HelpDeskTicketDifficultyUUID
{
get
{
return this._helpDeskTicketDifficultyUUID;
}
set
{
this._helpDeskTicketDifficultyUUID = value;
}
}
public int HelpDeskTicketDifficultyID
{
get
{
return _helpDeskTicketDifficultyID;
}
set
{
_helpDeskTicketDifficultyID = value;
}
}

public string HelpDeskTicketDifficultyName
{
get
{
return _helpDeskTicketDifficultyName;
}
set
{
_helpDeskTicketDifficultyName = value;
}
}
#endregion

}
}



"herbert" <he*****@discussions.microsoft.comwrote in message
news:8C**********************************@microsof t.com...
>I defined a WCF callback contract:
<ServiceContract()_
Interface IEBAPEvents
'this interface defines the events to be triggered in the clients
'the EBAP pattern defines two events: a progress event and a completion
event

<OperationContract(IsOneWay:=True)_
Sub OnProgressChanged(ByVal e As FindFilesProgressChangedEventArgs)

<OperationContract(IsOneWay:=True)_
Sub OnFindFilesCompleted(ByVal e As FindFilesCompletedEventArgs)
End Interface

and the event args:

<DataContract()_
Public Class FindFilesProgressChangedEventArgs
Inherits ProgressChangedEventArgs
...

<DataContract()_
Public Class FindFilesCompletedEventArgs
Inherits AsyncCompletedEventArgs
When starting the WCF host an error message appears:
Error: Type 'System.ComponentModel.ProgressChangedEventArgs' cannot be
seria
d. Consider marking it with the DataContractAttribute attribute, and
marking
of its members you want serialized with the DataMemberAttribute attribute.

How do I add an attribute to the .NET class ProgressChangedEventArgs ?

thank you very much
herbert

Sep 5 '07 #2
The Serialize() attribute does not help.
herbert
Sep 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a...
7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
5
by: Russell Warren | last post by:
I just ran across a case which seems like an odd exception to either what I understand as the "normal" variable lookup scheme in an instance/object heirarchy, or to the rules regarding variable...
1
by: adacai | last post by:
I'm now trying to use WCF for our SOA archecture, but I found the svcutil generated proxy a bit confused. Take the following code public interface ICatalog { Hashtable GetItems();
5
by: Jonathan Kay | last post by:
Hi, I'd like to my WCF webservice to work both on SSL and without. Unfortunately searching has led to dead ends, references to changes that only work on the old previous beta versions and I...
4
by: Dave Burns | last post by:
Hello, I am trying to specify a logical default value for a in a WCF Web Service using basicHttpBinding. I realize that the language defaults are: int - 0 string - null bool - false
16
by: =?Utf-8?B?U3RldmUgQmFya2Vy?= | last post by:
WCF Question Hi guys, I’m pretty new to WCF, and have a basic question about how it works. I’m trying to use WCF to write an “SOA-system”, and am having a few problems. The...
5
by: =?Utf-8?B?TWFyaw==?= | last post by:
I'm researching what is the best way to create a generic WCF proxy wrapper that has the following requirements: 1. Remove the System.ServiceModel config section requirement for clients. We have...
2
by: Steven Cheng | last post by:
Hi Gary, As for the setting you mentioned, it is used to custimze the received data size limitation of WCF binding(such as NetTcpBinding or HttpBinding). After you have definite a customized...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.