DataConnector
構成
ADO.NET provider for CSV > 構成

To create a configuration for an HTTP CSV source, you need to configure the tables in the database. Each table should be separated into four sections: SelectOperation, InsertOperation, UpdateOperation, and DeleteOperation.

In the following example, the <Table> tag is used to configure each table in the database and divide it into the sections discussed above. To enable CRUD operations for an HTTP/HTTPS CSV source, the provider offers custom API configurations through a configuration file. The API configuration file should be in XML format and should include the configuration for all CRUD operations supported by the CSV source. Below is an example of an XML API configuration file:

HTML
コードのコピー
<Api_Config>
   <Table name="Album">
      <SelectOperation>
         <Uri>"GET_url"/Album</Uri>
         <Method>Get</Method>
         <Response>
            <TableName name="Album" type="string"></TableName>
            <Column name="AlbumId" isKey="true" type="int">AlbumId</Column>
            <Column name="Title" type="string">Title</Column>
            <Column name="ArtistId" type="int">ArtistId</Column>
         </Response>
      </SelectOperation>
      <InsertOperation>
         <Uri>"POST_url"/Album</Uri>
         <Method>Post</Method>
         <Body>
            <TableName name="Album" type="string"/>
            <Column name="AlbumId" type="int">AlbumId</Column>
            <Column name="Title" type="string">Title</Column>
            <Column name="ArtistId" type="int">ArtistId</Column>
         </Body>
      </InsertOperation>
      <UpdateOperation>
         <Uri>"PUT_url"/Album</Uri>
         <Method>PUT</Method>
         <Body>
            <TableName name="Album" type="string"/>
            <Column name="AlbumId" type="int">AlbumId</Column>
            <Column name="Title" type="string">Title</Column>
            <Column name="ArtistId" type="int">ArtistId</Column>
         </Body>
      </UpdateOperation>
      <DeleteOperation>
         <Uri>"DELETE_url"/api/Album/{Param1}</Uri>
         <Method>DELETE</Method>
         <Paramter name="Param1" type="int">AlbumId</Paramter>
      </DeleteOperation>
   </Table>
   <Table name="Customer">
      <SelectOperation>
         <Uri>"GET_url"/Customer</Uri>
         <Method>Get</Method>
         <Response>
            <TableName name="Customer" type="string"></TableName>
            <Column name="CustomerId" isKey="true" type="int">CustomerId</Column>
            <Column name="FirstName" type="string">FirstName</Column>
         </Response>
      </SelectOperation>
      <InsertOperation>
         <Uri>"POST_url"/api/Customer</Uri>
         <Method>Post</Method>
         <Body>
            <TableName name="Customer" type="string"/>
            <Column name="CustomerId" isKey="true" type="int">CustomerId</Column>
            <Column name="FirstName" type="string">FirstName</Column>
         </Body>
      </InsertOperation>
      <UpdateOperation>
         <Uri>"PUT_url"/Customer</Uri>
         <Method>PUT</Method>
         <Body>
            <TableName name="Customer" type="string"/>
            <Column name="CustomerId" isKey="true" type="int">CustomerId</Column>
            <Column name="FirstName" type="string">FirstName</Column>
         </Body>
      </UpdateOperation>
      <DeleteOperation>
         <Uri>"DELETE_url"/Customer/{Param1}</Uri>
         <Method>DELETE</Method>
         <Paramter name="Param1" type="int">CustomerId</Paramter>
      </DeleteOperation>
   </Table>
</Api_Config>

The API configuration file can be passed to the provider through the API Config File property in the connection string:

C#
コードのコピー
static string csvConnectionString = $"Uri='<uri>';API Config File='api_config.xml'";