Re: Declarative Data Access

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: David Browne (meat_at_hotmail.com)
Date: 11/05/04


Date: Fri, 5 Nov 2004 13:50:01 -0600


"Angelos Karantzalis" <akarantzalis@yahoo.com> wrote in message
news:enUDeq2wEHA.1976@TK2MSFTNGP09.phx.gbl...
> Hi guys,
>
> for a while now, we've been flirting with the idea of having a single
> component in our app that handles all the plumbing for our Db calls (
> creating connections, Commands & Parametes etc. ) through an xml
> definition
> of each Db call.
>
> For instance, a call to a Stored Procedure would be described like this:
>
> <data-action id="AddIncident" type="1" data-source="local"
> query="sp_AddIncident" cached="false"
> cache-timeout="0" sql-type="0">
> <params>
> <param name="@Name" type="String" required="true" />
> <param name="@Descr" type="String" required="false" />
> <param name="@StatusID" type="Int64" required="false" />
> <param name="@TypeID" type="Int64" required="false" />
> <param name="@DtOccured" type="DateTime" required="false" />
> <param name="@DtReported" type="DateTime" required="false" />
> <param name="@ReportedBy" type="String" required="false" />
> <param name="@Place" type="String" required="false" />
> <param name="@Cause" type="String" required="false" />
> <param name="@OrganizationID" type="Int64" required="false" />
> <param name="@Notes" type="String" required="false" />
> <param name="@SysUser" type="String" required="false" />
> </params>
> </data-action>
>
> .. and you could use the component in manner like:
>
> DataSet results = DataActionManager.execute("AddIncident", new
> object[]{"testname", null, null, 4 ... });

The XML is a good first step, but I wouldn't use it at runtime. Build a
small program which will read the XML file and output a source code file
which executes these procedures and compile that file into your project.
Then in your code you could call the procedure like this:

   DataSet results = dal.AddIncident("testname",null,null,4,...);

You get the best of both worlds, plus you get typesafe binding of your
application code to your database interface, so if you pass a string where
you should pass an int, the compiler will complain.

David



Relevant Pages

  • Re: Declarative Data Access
    ... we've been flirting with the idea of having a single ... > component in our app that handles all the plumbing for our Db calls ( ... small program which will read the XML file and output a source code file ... which executes these procedures and compile that file into your project. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: How to pass information, classes between forms in Windows Application mode [ FINALLY!]
    ... In a WinForms app generated by Visual Studio, ... A constructor in my "book" is the stuff that appears in public ... wouldn't compile as the appropriate constructor signature hasn't been ... declarations, it will compile. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Compile ASP.Net 2.0
    ... That's why there was a ClientID property in v1.x. ... Anyone would certainly need to do thorough testing before moving their app live under v2.0. ... There is no longer an underscore starting the prefix of a control in a user control. ... If your ASP.NET 1.x app didn't use VS.NET to compile, then you can just deploy it as-is and let the demand compile take care of ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: CF faster than MFC?
    ... MFC and basic Win32 compile to machine code at compile time. ... it's possible to write an MFC app that is slower than a CF ...
    (microsoft.public.pocketpc.developer)
  • Re: MDE and runtime
    ... but at this point I may be sending the app to clients with nothing more ... I have Access 2003 with VB Tools, so I have no way to compile to an earlier ... reference sits in the ...Office10 folder. ...
    (microsoft.public.access.devtoolkits)