WCF

R4R® WCF with C# WCF Tutorials
(追記) (追記ここまで)
(追記) (追記ここまで)
Data Contract Generics

Generics are specific to .NET, and using them would avoid the service-oriented nature of WCF and use bounded generic types in your data contracts, as long as you specify the type parameters in the service contract and as long as the specified type parameters have valid data contracts.We cannot define WCF contracts that rely on generic type parameters.

Using bounded generic types Example

[DataContract]
class MyClass<T>
{
[DataMember]
public T m_MyMember;
}
[ServiceContract]
interface IMyContract
{
[OperationContract]
void MyMethod(MyClass<int> obj);
}
(追記) (追記ここまで)
Collections

A collection is any type that supports the IEnumerable or IEnumerable<T> interfaces. All of the built-in collections in .NET, such as the array, the list, and the stack support these interfaces.

A data contract can include a collection as a data member, or a service contract can define operations that interact with a collection directly. Because .NET collections are .NET-specific, WCF cannot expose them in the service metadata, yet because they are so useful, WCF offers dedicated marshaling rules for collections.

Example:

ServiceContract]
interface IContactManager
{
 [OperationContract]
 IEnumerable<Contact> GetContacts( );
 ...
}
class ContactManager : IContactManager
{
 List<Contact> m_Contacts = new List<Contact>( );
 public IEnumerable<Contact> GetContacts( )
 {
 return m_Contacts;
 }
 ...
}
(追記) (追記ここまで)
Hot Topics

Database & SQL

HR FAQs

Interview & FAQs

ASK Questions

PHP

Testing

More Links

Tutorials

Articles

Source Code

e-Books

Certifications

FAQS

Copyright ©2021-22 r4r.co.in, all rights reserved. Theguestspost.com
Sitemap
Career
Post comment
About us
Subscription
Unsubscription

AltStyle によって変換されたページ (->オリジナル) /