472,980 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Accessing Class Properties

When designing a DAL (data access layer), I designed the methods to
return custom classes that contain properties. Example:

public class Employee
{
private string _name;

public string Name
{
get { return _name; }
}

public Employee()
{
_name = "Employee Name";
}
}

[...]

public static Employee GetEmployee()
{
return new Employee();
}

The requirements have since changed completely from what they were
originally and I'll have to design the DAL as a web service. I didn't
think this would be a big deal, but apparently properties are not
serialized as XML as I had expected.

There is quite a bit of custom code developed in the DAL, so I'm
obviously looking for the simplest approach to modifying my original
code into something that can be accessed through a web service.

Does anybody have any suggestions on how to implement this design change
as seamless as possible?

Thank you in advance,

--
Sean
Dec 14 '06 #1
4 1208
How about implementing webmethods that get/set internal class property
values?
"senfo" <en**********@yahoo.comI-WANT-NO-SPAMwrote in message
news:Om**************@TK2MSFTNGP04.phx.gbl...
When designing a DAL (data access layer), I designed the methods to return
custom classes that contain properties. Example:

public class Employee
{
private string _name;

public string Name
{
get { return _name; }
}

public Employee()
{
_name = "Employee Name";
}
}

[...]

public static Employee GetEmployee()
{
return new Employee();
}

The requirements have since changed completely from what they were
originally and I'll have to design the DAL as a web service. I didn't
think this would be a big deal, but apparently properties are not
serialized as XML as I had expected.

There is quite a bit of custom code developed in the DAL, so I'm obviously
looking for the simplest approach to modifying my original code into
something that can be accessed through a web service.

Does anybody have any suggestions on how to implement this design change
as seamless as possible?

Thank you in advance,

--
Sean

Dec 14 '06 #2
Scott M. wrote:
How about implementing webmethods that get/set internal class property
values?
I have nothing against this idea, per sey; I'm just trying to avoid
having to rewrite quite a bit of custom code, if that's possible. If
there are no other alternatives, I'll just have to do it.

Thank you for the response,

--
Sean
Dec 14 '06 #3
Scott M. wrote:
How about implementing webmethods that get/set internal class property
values?
The thing that doesn't make sense to me is that it's possible to, for
example, return a DataSet object from a WebMethod. The DataSet object
is useless without its properties, so how does .NET manage to
successfully serialize a DataSet object for use on .NET clients, whereas
the class I wrote is not?

Thank you again,

--
Sean
Dec 14 '06 #4
A WebService class itself doesn't expose properties over the web (as you
found out), but you can certainly create your own serializable class that
can be returned from a WebService. Once the consumer recieves and
de-serailizes it, the consumer would be able to access the properties.
BUT - - you must make the class serializable yourself correctly to ensure
that the properties will serialize/deserialize correctly.

It's the difference between calling a WebService class and returning a
serialized class (not the same thing).
"senfo" <en**********@yahoo.comI-WANT-NO-SPAMwrote in message
news:u9**************@TK2MSFTNGP03.phx.gbl...
Scott M. wrote:
>How about implementing webmethods that get/set internal class property
values?

The thing that doesn't make sense to me is that it's possible to, for
example, return a DataSet object from a WebMethod. The DataSet object is
useless without its properties, so how does .NET manage to successfully
serialize a DataSet object for use on .NET clients, whereas the class I
wrote is not?

Thank you again,

--
Sean

Dec 14 '06 #5

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

Similar topics

3
by: joealey2003 | last post by:
Hi all... I included a css file on my html and i need to check some properties. The html is: <style id="myid" src="mycsspage.css"> </style> Now i need something to access it like: ...
1
by: Jason Bell | last post by:
Every example of properties I've seen have used simple types such as integers and strings. Here's the scenario I'm trying to work out (3D graphics programming): I have a class called...
6
by: DKode | last post by:
Ok, kind of a silly question I just want to know what the proper method is, When I have local Properties, ie: private bool _someVal; public bool SomeVal { get { return _someVal; } }
8
by: dwok | last post by:
I have been wondering this for a while now. Suppose I have a class that contains some private member variables. How should I access the variables throughout the class? Should I use properties that...
5
by: Cyril Gupta | last post by:
Hello, I have a class inside another class. The Scenario is like Car->Engine, where Car is a class with a set of properties and methods and Engine is another class inside it with its own set of...
37
by: pochartrand | last post by:
Hello, Is there a way to manipulate or at least read the pseudo-class of an element ? I know the style attribute can be accessed and gives the CSS properties for a particular element....
3
by: Alex | last post by:
Hi all, I'm trying to create an arraylist of a user control class... I'm able to define the list and add objects (panels) to it, but I can access and of the panel properties using an index... ...
4
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying...
8
by: RSH | last post by:
Hi, I have a situation where I have a Parent Object (Company) which has several public properties. The Company Object also creates an Employees object which has its ow set of functions and...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.