I am trying to use petapoco with my .NET core MVC application, I have installed petapoco compiled as stated in another answer but don't know what to do next, I searched many places but most of them had been using the previous versions of petapoco and not the latest one, Can someone please help and provide some resources link as to how am I supposed to connect it with my SQL server using a connection string, and since now their documentation suggested to use PetaPoco.DBEntityGenerator instead of T4 templates, I have no idea how to use it.
Start by reading the Quick start guide
To connect to your db, you can start with the samples given:
// Normal
var db = new PetaPoco.Database("connectionStringName");
// Or the fluent configuration (PostgreSQL as an example)
var db = DatabaseConfiguration.Build()
.UsingConnectionString("Host=127.0.0.1;Username=petapoco;Password=petapoco;Database=petapoco;Port=5001")
.UsingProvider<PostgreSQLDatabaseProvider>()
.UsingDefaultMapper<ConventionMapper>(m =>
{
m.InflectTableName = (inflector, s) => inflector.Pluralise(inflector.Underscore(s));
m.InflectColumnName = (inflector, s) => inflector.Underscore(s);
})
.Create();
V6 only change the package and dropped support for some thing like T4, but you don't need the templates to start. The rest it's the same as V5