Hi all,
I created a Class defined as:
public class GenericDataAccess<T: DataAccessObject<Twhere T :
DBObject
This is my base class. I reuse it in every project. Now, in a
particular project I have another class:
public class DataAccess<T>: GenericDataAccess<Twhere T:DBObject
This last class have methods as:
public static List<TgetAll()
public static T getOne()
....
I also have one method called:
public static bool IsLogin(string userName, string password)
I would like to make this method accesible just for one class, that is
called User and inherits from DBObject.
But I do not want it to be accesible for the rest of the classes that
inherit from DBObject (i.e. Role, Apartment...)
Any idea of how can I implement my idea?
Thanks in advance 3 1134
On 12 Apr, 13:42, "VicToro" <vicp...@googlemail.comwrote:
Hi all,
I created a Class defined as:
public class GenericDataAccess<T: DataAccessObject<Twhere T :
DBObject
This is my base class. I reuse it in every project. Now, in a
particular project I have another class:
public class DataAccess<T>: GenericDataAccess<Twhere T:DBObject
This last class have methods as:
public static List<TgetAll()
public static T getOne()
...
I also have one method called:
public static bool IsLogin(string userName, string password)
I would like to make this method accesible just for one class, that is
called User and inherits from DBObject.
But I do not want it to be accesible for the rest of the classes that
inherit from DBObject (i.e. Role, Apartment...)
Any idea of how can I implement my idea?
Hello Vic,
your question raises the doubt you are correctly modeling your
objects.
If a derived class does not need a parental field or property then you
are *probably* using wrongly the concept of inheritance.
It makes sense that D inherits from P only if D "is a" P.
When one needs etherogeneous objects to share properties I find
convenient to use interfaces.
Anyway I'd like to hear others' opinions about that.
-Pam
>
Thanks in advance
If you only want the method to be accessible to one derived class, define it
in the derived class.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net
"VicToro" <vi*****@googlemail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
Hi all,
I created a Class defined as:
public class GenericDataAccess<T: DataAccessObject<Twhere T :
DBObject
This is my base class. I reuse it in every project. Now, in a
particular project I have another class:
public class DataAccess<T>: GenericDataAccess<Twhere T:DBObject
This last class have methods as:
public static List<TgetAll()
public static T getOne()
...
I also have one method called:
public static bool IsLogin(string userName, string password)
I would like to make this method accesible just for one class, that is
called User and inherits from DBObject.
But I do not want it to be accesible for the rest of the classes that
inherit from DBObject (i.e. Role, Apartment...)
Any idea of how can I implement my idea?
Thanks in advance
"VicToro" <vi*****@googlemail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
Hi all,
I created a Class defined as:
public class GenericDataAccess<T: DataAccessObject<Twhere T :
DBObject
This is my base class. I reuse it in every project. Now, in a
particular project I have another class:
public class DataAccess<T>: GenericDataAccess<Twhere T:DBObject
This last class have methods as:
public static List<TgetAll()
public static T getOne()
...
I also have one method called:
public static bool IsLogin(string userName, string password)
I would like to make this method accesible just for one class, that is
called User and inherits from DBObject.
But I do not want it to be accesible for the rest of the classes that
inherit from DBObject (i.e. Role, Apartment...)
Any idea of how can I implement my idea?
public class UserDataAccess : DataAccess<User>
{
public static bool IsLogin(string userName, string password) { ... }
}
>
Thanks in advance This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andreas Huber |
last post by:
What follows is a discussion of my experience with .NET generics & the
..NET framework (as implemented in the Visual Studio 2005 Beta 1),
which leads to questions as to why certain things are the...
|
by: Michael S |
last post by:
Why do people spend so much time writing complex generic types?
for fun?
to learn?
for use?
I think of generics like I do about operator overloading.
Great to have as a language-feature, as...
|
by: uttara |
last post by:
I have a generic collection which I am using in classes to store a
collection of embedded objects.
Class Employee: IEntity
{
Private string mName;
Private int mEmployeeID;
….
Private...
|
by: Chuck Cobb |
last post by:
I have a question regarding generics: Suppose I want to create some generic
collection classes:
Collection<Cats> c;
Collection<Dogs> d;
and both Cats and Dogs are inherited from a base class...
|
by: Peter Kirk |
last post by:
Hi
I have never used generics before, and I was wondering if the following sort
of use was acceptable/normal for a method:
public IList<IPerson> GetPersons()
{
IList<IPerson> personList =...
| |
by: nick_nw |
last post by:
Hi,
What significant advantages do generics give me over passing objects
around as 'object' and casting when needed?
I was asked this recently and started off by saying, "well of course...
|
by: cwineman |
last post by:
Hello,
I'm hoping to do something using Generics, but I'm not sure it's possible.
Let's say I want to have a bunch of business objects and a data access class
cooresponding to each business...
|
by: Bryan Kyle |
last post by:
Hi All,
I'm fairly new to C# and Generics and I'm wondering if anyone has some
suggestions for me.
I'm trying to implement a simple DAO framework using generics to keep
my code as clean as I...
|
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= |
last post by:
Hi all
I have some problems with Crystal Reports (Version 10.2, Runtime 2.0).
In Section3 I have added a OLE Object (Bitmap).
Now when I open the report in my code I would
like to set this...
|
by: Anders Borum |
last post by:
Hello,
I've worked on an API for quite some time and have (on several occasions)
tried to introduce generics at the core abstract level of business objects
(especially a hierarchical node). The...
|
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...
| |
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,...
|
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...
|
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,...
|
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...
|
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 project—planning, coding, testing,...
|
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...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |