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:
- Start Visual Studio, on the File menu select New, and then select Project.
- In the New Project dialog box, select Visual Basic or Visual C# as the programming language.
- In the Templates pane, select Class Library project.
- Type GettingStartedPostSql as the name of the project. Click OK.
- Integrate the project with the Telerik.DataAccess.Fluent NuGet package.
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>
- Create POCO classes for your persistent entities.
- Using the Fluent Mapping API create the metadatasource class where the mapping is defined. An example is available here.
- 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.