Re: Dataset without a database - editing the .cs file

From: Brad Williams (spam_at_spam.com)
Date: 03/24/04


Date: Wed, 24 Mar 2004 14:13:39 -0800

Yes, changes to generated code will be lost.

You could probably inherit from the dataset class. But that might not be
the best choice, because if you are adding some business logic, then your
new class will probably be "more than" a dataset ... it will be something
you might call a "data access component" or "business component", which
*uses* a dataset. So maybe consider creating a new class that contains the
dataset as one private field in it. It depends on the meaning of the
functionality you want to add, and on the scope of the project.

Brad Williams

"C P" <nospam@nospam.com> wrote in message
news:eIIerzdEEHA.2640@TK2MSFTNGP09.phx.gbl...
> Background: I'm net to .NET and using C#.
>
> I see that I can create an .xsd file at VS.NET will create a corresponding
> C# class for me that is a corresponding dataset to my .xsd schema. This
> seems perfect for the class I want to construct. I'd like to have
consumers
> of my Dataset class be able to access my class as a Dataset. I know this
> can all be done. However, I'd like to extend the Dataset class that is
> autogenerated from my schema to add some functionality. Is there a safe
way
> to do this? Or, will any change to the DataSet's schema cause the
> underlying class to be re-written and thus lose all my code? I suppose I
> could add my code to a subclass of the DataSet class... Is what I'm
> attempting a bad idea? Is there a better way to approach this?
>
> Thanks,
> Chris
>
>



Relevant Pages

  • Re: How to use FindBy in typed DataSet?
    ... It is called from with Visual Studio when you save a XSD file. ... code generation to examine the schema and create the appropriate code. ... compile time, greatly reducing the possibility of errors in assigning ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Decouple SQL queries from class in OOP design
    ... suggesting that you can raise application abstraction level to the ... > functionality and _when_ to invoke that functionality. ... If I change the schema, ... > encapsulating the business functionality required in one place? ...
    (comp.object)
  • Re: Decouple SQL queries from class in OOP design
    ... There is no change to the functionality supported ... > by the database, but the schema changes. ... > Denormalization for performance, as noted above, will definitely ... serioulsly chllenge his SQL tuning abilities. ...
    (comp.object)
  • Re: Decouple SQL queries from class in OOP design
    ... There is no change to the functionality ... but the schema changes. ... >>> If they are using the same database schema, ... >> A particular schema is an implementation detail. ...
    (comp.object)
  • RE: ReadXML and data types
    ... If I want to put the schema in a separate XSD file, ... with my XML file for ReadXml to use? ... > Kevin Yu ...
    (microsoft.public.dotnet.xml)