![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the FTP via the CData ADO.NET Data Provider for FTP. To achieve this, we will use LINQ to Entity Framework, which facilitates the generation of connections and can be seamlessly employed with any CData ADO.NET Data Providers to access data through LINQ.
See the help documentation for a guide to setting up an EF 6 project to use the provider.
Enter your data source connection information.
To connect to FTP or SFTP servers, specify at least RemoteHost and FileProtocol. Specify the port with RemotePort.
Set User and Password to perform Basic authentication. Set SSHAuthMode to use SSH authentication. See the Getting Started section of the data provider help documentation for more information on authenticating via SSH.
Set SSLMode and SSLServerCert to secure connections with SSL.
The data provider lists the tables based on the available folders in your FTP server. Set the following connection properties to control the relational view of the file system:
Stored Procedures are available to download files, upload files, and send protocol commands. See the Data Model chapter of the FTP data provider documentation for more information.
Below is a typical connection string:
RemoteHost=MyFTPServer;
Using the entity you created, you can now perform select , update, delete, and insert commands. For example:
FTPEntities context = new FTPEntities();
var mydirectoryQuery = from mydirectory in context.MyDirectory
select mydirectory;
foreach (var result in mydirectoryQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.Filesize);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the FTP Data Provider to get started:
Download NowLearn more:
👁 FTP IconAn easy-to-use database-like interface for .NET applications access to remote files and directories.