473,396 Members | 1,804 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,396 software developers and data experts.

Static Classes And Code Reusability

TRScheel
638 Expert 512MB
Platform: Windows Vista
Language: ASPX / C#

I am trying to make a business library for where I work, and I have everything figured out and done except for the ObjectDataSource portion.

If any of you have used the ObjectDataSource, it binds to a static (you could bind it to a class that isnt static, but then the values and items within that class are lost after a different page load) class that has a select, update, delete, and insert method. Now thats all fine and good, but I would like to not have to copy/paste the same code for every project (hence the library... we were reusing a lot of code).

My issue is that I have a good template for the a class to be inherited and used in a project, thus that it has a select, update, insert, and delete functions, in addition to other functions needed, but .NET does not allow static classes to inherit from other static, or non static, classes.

The only viable way I see to make this possible is to do something like this (and mind you, psuedo code):

namespace Library
{
public class DataSetObjectBase
{
private list<object> objects;

public DataReader Select() {}
public void Update(object obj){}
public void Delete(object obj){}
public void Insert(object obj){}
}
}

namespace Project
{
public static class DataSetObject
{
private static Library.DataSetObjectBase base;

public static DataReader Selet() {return base.Select(); }
etc...

}
}

But with the above method it would amost be better to just include a code snippet... I would rather have a solution similiar to:

public static class DataSetObject : DataSetObjectBase
{
private static new list<otherObjects> objects;
}

for instance.. any ideas?

EDIT: Sorry, accidently pressed enter and had it submit before I was done typing
Apr 24 '07 #1
1 1247
TRScheel
638 Expert 512MB
Everyone is just as equally confused as I am?
Apr 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Pierre Barbier de Reuille | last post by:
Ok, I first want to stress that I looked through the newsgroups archives (on Google) for an answer to my question, but I didn't find it. It's about the interface of the set classes as defined in...
14
by: knocte | last post by:
Hello. I have a problem with C# language. I want to define an algorithm on a static function inside an abstract class. This function calls a static variable inside the same class. Then I want to...
9
by: Laban | last post by:
Hi, I find myself using static methods more than I probably should, so I am looking for some advice on a better approach. For example, I am writing an app that involves quite a bit of database...
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
47
by: mister catering | last post by:
I have a doubt... why is so dificult to reuse software developed under the same language (not only c of course) and under the same compiler?. It seems the language itself is not enough to build a...
15
by: eminemence | last post by:
Hi, Is it possible to implement a Singleton without using static variables or global variables. Thanks. --eminemence.
3
by: Steven W. Orr | last post by:
This is all an intro learning experience for me, so please feel free to explain why what I'm trying to do is not a good idea. In the Cookbook, they have a recipe for how to create global...
7
by: Bruce | last post by:
I've been searching for some information on the use of Classes in ASP, but found very little information. I found this http://www.daniweb.com/tutorials/tutorial19997.html . Are there more...
5
by: Andy B | last post by:
I have a class that I want to make static but it uses some objects that are instance objects. I keep getting a compiler error saying something about using instance objects in a static class or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
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...
0
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...

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.