Data Access has been discontinued. Please refer to this page for more information.

How to: Create A Model Based on PostgreSQL Database

This topic will walk you through the common task of creating a new Telerik Data Access model connected to a PostgreSQL database.

For this tutorial a database named MyDatabase with one table named customers will be used.

To create a new model:

  1. Start Visual Studio, on the File menu select New, and then select Project.
  2. In the New Project dialog box, select Visual Basic or Visual C# as the programming language.
  3. In the Templates pane, select Class Library project.
  4. Type GettingStartedPostSql as the name of the project. Click OK.
  5. Integrate the project with the Telerik.DataAccess.Fluent NuGet package.
  6. In the App.config file of the project, provide the connection string to the database:

    <connectionStrings>
        <add name="OracleConnection" 
             connectionString="User ID=root;Password=myPassword;
                               Host=localhost;Port=5432;Database=myDataBase"
             providerName="Npgsql" />
    </connectionStrings>
    
  7. Create POCO classes for your persistent entities.
  8. Using the Fluent Mapping API create the metadatasource class where the mapping is defined. An example is available here.
  9. Create your context class.

At this point you cat test the model through any application that is integrated with the Telerik.DataAccess.Core NuGet package.