Click here to Skip to main content
15,896,915 members
Articles / Programming Languages / SQL

DataLoaders - Unified Data to Object Binding

Rate me:
Please Sign up or sign in to vote.
4.72/5 (35 votes)
31 Oct 2004CPOL19 min read 76.3K   2.9K   83  
A framework to completely separate objects from their data source - allowing any data source to be used without prior consideration in your code or designs. Databases, text files, web services and potentially anything else can all be used or swapped transparently.
<html dir="LTR">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>AccessDataLoader.NameMappingCallback Event</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />
  </head>
  <body id="bodyID" class="dtBODY">
    <div id="nsbanner">
      <div id="bannerrow1">
        <table class="bannerparthead" cellspacing="0">
          <tr id="hdr">
            <td class="runninghead">DataLoader Documentation</td>
            <td class="product">
            </td>
          </tr>
        </table>
      </div>
      <div id="TitleRow">
        <h1 class="dtH1">AccessDataLoader.NameMappingCallback Event
					</h1>
      </div>
    </div>
    <div id="nstext">
      <p> Event for mapping data item column names to those on the data source. </p>
      <div class="syntax">
        <span class="lang">[Visual�Basic]</span>
        <br />Public�Event�NameMappingCallback�As�<a href="Bttlxe.Data.NameMappingCallbackHandler.html">NameMappingCallbackHandler</a></div>
      <div class="syntax">
        <span class="lang">[C#]</span>
        <br />public�event�<a href="Bttlxe.Data.NameMappingCallbackHandler.html">NameMappingCallbackHandler</a>�NameMappingCallback;</div>
      <p>
      </p>
      <h4 class="dtH4">Implements</h4>
      <p>
        <a href="Bttlxe.Data.IDataLoader.NameMappingCallback.html">IDataLoader.NameMappingCallback</a>
      </p>
      <h4 class="dtH4">Remarks</h4>
      <p> This event is typically consumed by your Global class and provides a way for to specify the column names on the data source that map to those in the data item. </p>
      <h4 class="dtH4">Example</h4>
      <p>
        <p>The following example shows how the name mapping can be used.</p>
        <p class="lang">[C#]</p>
        <pre class="code">Loader.NameMappingCallback += new NameMappingCallbackHandler(Loader_NameMappingCallback);

...

public void Loader_NameMappingCallback(string table, ref DataItemDictionary keys)
{
    keys.Clear();

    switch (table)
    {
        case "News":
            keys.Add("ID", "n_id");
            keys.Add("Title", "n_title");
            keys.Add("Description", "n_description");
            keys.Add("Owner", "n_owner");
            keys.Add("Created", "n_created");
            break;
        case "Product":
            keys.Add("ID", "pr_id");
            keys.Add("Name", "pr_name");
            keys.Add("Description", "pr_description");
            keys.Add("Price", "pr_price");
            break;
    }
}
</pre>
      </p>
      <h4 class="dtH4">See Also</h4>
      <p>
        <a href="Bttlxe.Data.AccessDataLoader.html">AccessDataLoader Class</a> | <a href="Bttlxe.Data.html">Bttlxe.Data Namespace</a></p>
      <object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;">
        <param name="Keyword" value="NameMappingCallback event">
        </param>
        <param name="Keyword" value="NameMappingCallback event, AccessDataLoader class">
        </param>
        <param name="Keyword" value="AccessDataLoader.NameMappingCallback event">
        </param>
      </object>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:dwulff@bttlxe.com?subject=DataLoader%20Documentation%20Documentation%20Feedback:%20AccessDataLoader.NameMappingCallback%20Event&#xD;&#xA;						">Send comments on this topic.</a>
        </p>
        <p>
          <a href="http://www.bttlxe.com">Copyright 2004 Battleaxe Software Ltd.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
  </body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO Bttlxe Ltd & Incentica Ltd
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions