-
Notifications
You must be signed in to change notification settings - Fork 600
DB Providers
PetaPoco supports by default the following providers: SQL Server, SQL Server CE, MS Access, SQLite, MySQL, MariaDB, PostgreSQL, Firebird DB, and Oracle. You can also create your own custom provider.
This is the default provider.
The new SQL Client form MS. See their Github page for more info.
This MS access provider will work with both the Jet and Ace OLEDB providers. The only item which isn't supported is the query paging API calls. The reason for this is because the lack of paging syntax support by MS Access means a generic method to take a query and page it is very problematic.
Because of SQLite's simplified datatypes model, you will probably need to help PetaPoco map types. Is this possible via a registered mapper or using the newer fluent configuration.
var builder = DatabaseConfiguration.Build()
.UsingConnectionStringName("sqlite")
.UsingDefaultMapper<ConventionMapper>(m =>
{
m.FromDbConverter = (targetProperty, sourceType) =>
{
if (targetProperty != null && sourceType == typeof(long))
{
var type = !targetProperty.PropertyType.IsNullableType()
? targetProperty.PropertyType
: targetProperty.PropertyType.GetGenericArguments().First();
switch (Type.GetTypeCode(type))
{
case TypeCode.DateTime:
return o => new DateTime((long) o, DateTimeKind.Utc);
default:
return o => Convert.ChangeType(o, Type.GetTypeCode(type));
}
}
return null;
};
m.ToDbConverter = sourceProperty =>
{
var type = !sourceProperty.PropertyType.IsNullableType()
? sourceProperty.PropertyType
: sourceProperty.PropertyType.GetGenericArguments().First();
switch (Type.GetTypeCode(type))
{
case TypeCode.DateTime:
return o => ((DateTime) o).Ticks;
}
return null;
};
});
var db = builder.Create();
Nothing noteworthy
Supports the new MySqlConnector, in addition to the MySql.Data. See their Github page for more info.
Nothing noteworthy
A recent addition to PetaPoco.
Currently, there are no integration tests being run against an Oracle DB instance. We have plans to add this soon.
PetaPoco is proudly maintained by the Collaborating Platypus group and originally the brainchild of Brad Robinson