This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


■ I N T R O D U C I N G  W I N D O W S   C O M M U N I C AT I O N   F O U N D AT I O N 911



Download 21,46 Mb.
Pdf ko'rish
bet1738/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   1734   1735   1736   1737   1738   1739   1740   1741   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

I N T R O D U C I N G  W I N D O W S   C O M M U N I C AT I O N   F O U N D AT I O N



911

8849CH25.qxd  10/16/07  10:51 AM  Page 911




This interface defines three methods, one of which returns an array of the (yet-to-be-created)

InventoryRecord type. You may recall that the GetInventory() method of InventoryDAL simply

returned a DataTable object, which might make you question why our service’s GetInventory()

method does not do the same. 

While it would work to return a DataTable from a WCF service method, recall that WCF was

built to honor the use of SOA principles, one of which is to program against contracts, not imple-

mentations. Therefore, rather than returning the .NET-specific DataTable type to an external caller,

we will return a custom data contract (InventoryRecord) that will be correctly expressed in the con-

tained WSDL document in an agnostic manner. 

Also note that this interface defines an overloaded method named InsertCar(). The first ver-

sion takes four incoming parameters, while the second version takes an InventoryRecord type as

input. This data contract can be defined as so:

[DataContract]

public class InventoryRecord

{

[DataMember]



public int ID;

[DataMember]

public string Make;

[DataMember]

public string Color;

[DataMember]

public string PetName;

}

If you were to implement this interface as it now stands, build a host, and attempt to call these



methods from a client, you might be surprised to find a runtime exception. The reason has to do

with the fact that one of the requirements of a WSDL description is that each method exposed from

a given endpoint is 

uniquely named. Thus, while method overloading works just fine as far as C# is

concerned, the current web service specifications do not permit two identically named InsertCar()

methods. 

Thankfully, the [OperationContract] attribute supports a named property (Name) that allows

you to specify how the C# method will be represented within a WSDL description. Given this,

update the second version of InsertCar() as so:

public interface IAutoLotService

{

...




Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1734   1735   1736   1737   1738   1739   1740   1741   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish