Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# 2.0 Return DataReader object
Message
 
 
À
09/03/2012 15:08:51
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01537785
Message ID:
01537831
Vues:
22
>>I don't really have a framework. Let me describe what my code does.
>>
>>User enters some values (in a couple of textbox controls) of an .aspx page.
>>The C# code behind the page calls a method of a BIZ Class (I call it business class but I am not sure if it is technically so).
>>Anyway, the method of the BIZ class creates connection and get a data reader object based on the parameters passed (user entry).
>>The Data Reader is then returned from the BIZ class method to the page code behind and the values of the Data Reader are used in the Code Behind.
>>
>>So my challenge was/is that the BIZ class method should return a data reader but either OleDb type or SQL Server type (depending on the back end).
>>
>>Hopefully my explanation makes sense.
>
>The C# example you obtained in the other message is a replica of my data class, but at a high level only. That would be the way to follow. It is just that I have thousands of lines in mine which handles pretty much anything you could imagine in regards to a data class. It took me a while to build it. But, it was worth it at the end.
>
>As for the Hungarian reference, it is just a naming convention. The goal is to have one. I really do not care which one people uses as long as they have one I think this is good. This is what I teach. I wouldn't touch any code if there wouldn't be any convention in it. It would be a total waste of time. In such a case, people involved might as well start from scratch. Mine is dated from the earlier '90s from a class I took from Yair Alan Griver. This is kind of a reverse hungarian notification. I apply it to everything. It was first used in VFP, then in .NET and javascript. At least, when I see loConnection, I know it is a local variable of type object about the Connection namespace. As simple as it gets, cFirsName would then be a public property of type string for the first name. I have seen so many examples on the net with For i =.... Wow, when I see it down below the code, I say to myself what the heck is i for. But, if I see For lnCounter=... Then, down below the code, if I see a reference to it, I know it is a local variable of type integer for a counter. In VFP, most of the developers had a good naming convention. When I started to move to .NET, I saw that most of that disappeared in space and it was sad.

I agree with you that it is important to have a convention and follow it. I personally also use Hungarian in my C# code, even though many say it is not necessary. But like you, I have been using it in VFP for such a long time, it is ingrained in my brain.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform