Re: Making a generic Parameter class
From: SimonH (none_at_hotmail.com)
Date: 01/11/05
- Next message: John: "XP Service Pack 2 and Outlook."
- Previous message: huzz: "RE: access table cell by name not by index?"
- In reply to: Nick Malik [Microsoft]: "Re: Making a generic Parameter class"
- Next in thread: Nick Malik [Microsoft]: "Re: Making a generic Parameter class"
- Reply: Nick Malik [Microsoft]: "Re: Making a generic Parameter class"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 11 Jan 2005 09:09:59 -0800
Nick,
Thanks for your reply.
I've used the adapter and abstract factory patterns before.
What I need to know is if there is already a generic implementation class
for the IdbParameter interface that I can use?
Is the case basically that I need to make my own simple parameter implementation?
I'd rather not if there was already a simple implementation already as it
make my datalayer more complicated.
If I have to implement though, I'll just have to :-)
Thanks for your help
Kindest Regards
> SqlParameter is an implementation of an 'Adapter' pattern. This
> allows things like DataAdapter and DataReader to be able to use
> generic methods for using these objects without concern for which
> database lies underneath it. If you have a database (that is not
> either SQL Server or Oracle) that you want to access, simply creating
> objects that meets the same interface (MarshalByRefObject,
> IDbDataParameter, IDataParameter, ICloneable) will allow your methods
> to be used by the higher-level database objects.
>
> In other words, .Net already does this for you.
>
> What .Net doesn't do is provide you with an abstract factory. You can
> easily write one that returns an object of type IDbDataParameter when
> you want to create a new parameter object. Then you can use your
> factory to create generic objects, and in fact, can use these objects
> as generic ones (cross db) without knowing if the factory is
> connecting you to SQL Server objects, Oracle objects, or another set
> of Adapter objects.
>
> Please read up on the Abstract Factory pattern.
>
> http://www.dofactory.com/Patterns/PatternAbstract.aspx
>
> Disclaimer: Opinions expressed in this forum are my own, and not
> representative of my employer.
> I do not answer questions on behalf of my employer. I'm just a
> programmer helping programmers.
> --
> "SimonH" <none@hotmail.com> wrote in message
> news:9347632410525392812500@news.microsoft.com...
>> Hi all,
>>
>> I would like to make a generic set of methods that could be called
>>
> regardless
>
>> of the database behind the scenes.
>>
>> One of the methods I would like would take a string sql statement and
>> an array of DataParameter objects.
>>
>> The problem i have is there doesnt seem to be a generic DataParameter
>>
> class
>
>> that I can instantiate. There only seems to be specific
>> implementations
>>
> like
>
>> SQLParamater and so on.
>>
>> The is an interface called IDataParameter or something to that
>> effect, but of course I can't instantiate an interface.
>>
>> I need to be able to work with a non-specific parameter object.
>>
>> Does anyone know what I could do?
>>
>> Many thanks all
>>
>> Kindest Regards
>>
- Next message: John: "XP Service Pack 2 and Outlook."
- Previous message: huzz: "RE: access table cell by name not by index?"
- In reply to: Nick Malik [Microsoft]: "Re: Making a generic Parameter class"
- Next in thread: Nick Malik [Microsoft]: "Re: Making a generic Parameter class"
- Reply: Nick Malik [Microsoft]: "Re: Making a generic Parameter class"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|