473,326 Members | 2,127 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,326 software developers and data experts.

Overloading the = in c#

Here's the issue.. I wrote up the middle tier as a model of the objects to
my satisfaction. but the result is that instead of asp.net pages using
datasets to construct the gui, they are dealing with User[], Article[],
Category[]... etc.

My first thought was to overload the = operator so i can do

DataSet x = theUsers;

where the = would do the conversion and i can take the dataset to slap into
a datagrid.

I have thought up some ways, but just curious what everyone thinks is the
best way to deal with this. I cant use a normal function because it's an
array. aka .toDataSet() isnt gonna cut it unless i do
User.toDataSet(theUsers);

Nov 18 '05 #1
3 938

"shalafi" <ja**@bone.com> wrote in message
news:Oz**************@TK2MSFTNGP11.phx.gbl...
Here's the issue.. I wrote up the middle tier as a model of the objects to my satisfaction. but the result is that instead of asp.net pages using
datasets to construct the gui, they are dealing with User[], Article[],
Category[]... etc.

My first thought was to overload the = operator so i can do

DataSet x = theUsers;

where the = would do the conversion and i can take the dataset to slap into a datagrid.

I have thought up some ways, but just curious what everyone thinks is the
best way to deal with this. I cant use a normal function because it's an
array. aka .toDataSet() isnt gonna cut it unless i do
User.toDataSet(theUsers);


There's a whole databinding framework you can use. You need an adapter for
your business object to allow the UI to databind it.

http://msdn.microsoft.com/library/de...et02252003.asp
http://aspalliance.com/articleViewer.aspx?aId=77
http://www.codeproject.com/aspnet/OODatabinding.asp

David
Nov 18 '05 #2
thanks major!...

I've done quite a bit of OOP... java and c++. But that always takes a
backseat to learning the class libraries available. this will give me a big
boost in the right direction.
"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:Oi**************@TK2MSFTNGP11.phx.gbl...

"shalafi" <ja**@bone.com> wrote in message
news:Oz**************@TK2MSFTNGP11.phx.gbl...
Here's the issue.. I wrote up the middle tier as a model of the objects to
my satisfaction. but the result is that instead of asp.net pages using
datasets to construct the gui, they are dealing with User[], Article[],
Category[]... etc.

My first thought was to overload the = operator so i can do

DataSet x = theUsers;

where the = would do the conversion and i can take the dataset to slap

into
a datagrid.

I have thought up some ways, but just curious what everyone thinks is the best way to deal with this. I cant use a normal function because it's an array. aka .toDataSet() isnt gonna cut it unless i do
User.toDataSet(theUsers);


There's a whole databinding framework you can use. You need an adapter

for your business object to allow the UI to databind it.

http://msdn.microsoft.com/library/de...et02252003.asp http://aspalliance.com/articleViewer.aspx?aId=77
http://www.codeproject.com/aspnet/OODatabinding.asp

David

Nov 18 '05 #3
You can call arrays the same way that you call Datasets in ASP.Net
Pages. Say you have an DataTalble with a field of "MyProperty". Then
you call it in the page like <%# DataBinder.Eval(Container.DataItem,
"MyProperty") %>, but if you are using an actual array with a object
that has a property called my property you can do <%#
DataBinder.Eval(Contaier, "MyProperty") %> and it will work fine.

http://msdn.microsoft.com/library/de...evaltopic1.asp

Hope this helps.

shalafi wrote:
Here's the issue.. I wrote up the middle tier as a model of the objects to
my satisfaction. but the result is that instead of asp.net pages using
datasets to construct the gui, they are dealing with User[], Article[],
Category[]... etc.

My first thought was to overload the = operator so i can do

DataSet x = theUsers;

where the = would do the conversion and i can take the dataset to slap into
a datagrid.

I have thought up some ways, but just curious what everyone thinks is the
best way to deal with this. I cant use a normal function because it's an
array. aka .toDataSet() isnt gonna cut it unless i do
User.toDataSet(theUsers);

Nov 18 '05 #4

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

Similar topics

17
by: Terje Slettebø | last post by:
To round off my trilogy of "why"'s about PHP... :) If this subject have been discussed before, I'd appreciate a pointer to it. I again haven't found it in a search of the PHP groups. The PHP...
4
by: Dave Theese | last post by:
Hello all, I'm trying to get a grasp of the difference between specializing a function template and overloading it. The example below has a primary template, a specialization and an overload. ...
5
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that...
39
by: zeus | last post by:
I know function overloading is not supported in C. I have a few questions about this: 1. Why? is it from technical reasons? if so, which? 2. why wasn't it introduced to the ANSI? 3. Is there any...
45
by: JaSeong Ju | last post by:
I would like to overload a C function. Is there any easy way to do this?
31
by: | last post by:
Hi, Why can I not overload on just the return type? Say for example. public int blah(int x) { }
2
by: brzozo2 | last post by:
Hello, this program might look abit long, but it's pretty simple and easy to follow. What it does is read from a file, outputs the contents to screen, and then writes them to a different file. It...
15
by: lordkain | last post by:
is it possible to do some kind of function overloading in c? and that the return type is different
11
by: placid | last post by:
Hi all, Is it possible to be able to do the following in Python? class Test: def __init__(self): pass def puts(self, str): print str
10
by: Matthew | last post by:
Am I correct in thinking there is no method/function overloading of any kind in any version of PHP? Thanks, Matthew
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.