Hello everyone!
I have been looking for information regarding the SOA tenet of
decoupling the client interface from the web service interface. I
understand the value of not sharing a contract based on a class type;
instead, a contract based on the data is what we should be
implementing. However, information on how to properly implement this
in .NET 2.0 is pretty scarce.
I have been fiddling around with a simple web-service and client I
created just to test this idea. On the web-service side I have a
simple HelloWorld method that returns a new instance of the following
type :
public class WebService.Test
{
// data I would like to include in the contract
public string FirstName = "Hello";
public string LastName = "World";
// other data and methods I do not want in the contract
...
}
As you can see from the above comments the only data that needs to be
passed to the client are the FirstName and LastName fields; I do not
want the other data and methods to be passed/implemented on the client
side.
On the client side, I have the following Test class defined (very
simple and short for brevity) :
public class Client.Test
{
private string FirstName;
private string LastName;
public override string ToString()
{
return FirstName + " " + LastName;
}
}
As you already know, I can't cast the result of the web-method call to
the client-side version of Test. So the million dollar question is :
what is the best way to accomplish this?
On the client side I can update the web-reference and generate two
files : Reference.cs and Test.datasource . The Reference.cs file
contains the definition for the Test class which includes metadata for
the other data and methods that I do not want. I can, of course,
simply trim this automagically created Test class down to size (just
keep the FirstName and LastName fields) and implement whatever client-
side logic I want but it seems that every time you update the web-
reference you have to re-implement the code all over again since it
gets overwritten.
Would anyone point me in the right direction, maybe a few links or
excellent books? There must be a design pattern for this. I notice
that there's a DataContract attribute in .NET 3.0 but I'm limited to
the .NET 2.0 framework for now.
Regards,
Anthony 0 1755 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Yi |
last post by:
Hi,
I am a scientist and new to .NET programming. On my PC, I am using Windows
2000 professional with IIS, SQL Server 2000 (standard, personal), Visual
Basic .net (2003, standard). By following the demo code, I can generate the
web form to access the Northwind data in SQL server. When I tried to use
Server Explorer to add new Data Connection to Northwind, the “test
connection” always work, but click OK always give an error message:...
|
by: hch |
last post by:
dataAdapter.Update(data, "TableName") won’t work!
I was about to deploy my first website on the Internet only to discover that
the dataAdapter.Update() throws the Server Error in the third underline. It
was working fine before.
ConnectionString in Web.config:
-----------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
|
by: 21novembre |
last post by:
Hi all,
I made a question several days before to describe my strange trouble of
mysqldump. But I still can't figour it out. Well, I just want to ask
another question whether I could just backup my databases by copying
the data folder to some place? Then if I meet some disaster, could I
just copy the backup folder back to recover my databases?
Thank you.
Zh.y
|
by: Jon Davis |
last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current
browsers using:
<object id="extendedhtml" type="text/html" data="otherpage.html" width="250"
height="400"></object>
My question is how do I access the document DOM of this object in
Javascript? For example, "alert(extendedhtml.innerHTML);" doesn't work and
produces an unknown error. I'd like to both read and write to the document's
body element's innerHTML...
|
by: alederer |
last post by:
Hallo!
I have a table tstest(ts char(13) for bit data constraint a unique).
This column is filled in a trigger with generate_unique().
In a application (CLI), I have the values of this column as timestamp
representation: e.g.: select timestamp(ts) from tstest
1
| |
by: Jerry |
last post by:
I have an off-the-shelf app that uses an Access database as its
backend. One of the tables contains a field with an "OLE Object"
datatype. I'm writing some reports against this database, and I
believe this field contains data I need. When I view the table in
datasheet view, all I can see in this field is the string "Long
binary data".
So, I've got the problem of needing to extract data from this
field, but I don't know what format...
|
by: Alex Maghen |
last post by:
Hi. I had previously installed VS2005 beta 1. I carefully followed all the
steps (I thought) to deinstall it and then installed beta 2. According to the
documentation, the "Data" directory which was to be a "special" directory in
the docroot of an ASP.NET app, has been renamed to "app_data". That's a GOOD
thing because you guys were using up too many normal words for reserved
purposes. Anyway, the problem is that I have a "Data" directory...
|
by: Mejmeyster |
last post by:
Hi Everyone,
I have a table in which one of the text fields has become too small (since it only holds 255 characters). To remedy that, I'm trying to change the data type of that field to "memo" in design mode. However, when I go to save the new settings of my table, the error message "Record is too large" pops up and won't allow me to save the table. What am I doing wrong? I work with Access 97 in Windows XP.
Thanks for your help!
|
by: BobRoyAce |
last post by:
I am using Visual Studio 2008 w/ VB.NET.
For the database, I am using SQL Server 2005, which is running on a
dedicated server box.
I am creating a WinForms application for a client. It is run on any of
several employees' desktop PCs.
Now, they want to be able to "push" some of the data from the SQL
Server database up to a database on a website (also SQL Server 2005).
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |