-
Notifications
You must be signed in to change notification settings - Fork 600
DB Providers
PetaPoco supports the following providers: SQL Server, SQL Server CE, MS Access, SQLite, MySQL, MariaDB, PostgreSQL, Firebird DB, and Oracle.
This is the default provider.
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 note worthy
Nothing note worthy
Nothing note worthy
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