Class PetaPocoExtensions
Inheritance
System.Object
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public static class PetaPocoExtensions
Methods
BulkInsertRecords<T>(Database, IEnumerable<T>)
Performs the bulk insertion in the context of a current transaction with an optional parameter to complete the transaction
when finished
Declaration
[Obsolete("Use the method that specifies an SqlSyntaxContext instance instead")]
public static void BulkInsertRecords<T>(this Database db, IEnumerable<T> collection)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Collections.Generic.IEnumerable<T> |
collection |
|
Type Parameters
BulkInsertRecords<T>(Database, IEnumerable<T>, ISqlSyntaxProvider, Boolean)
Performs the bulk insertion
Declaration
public static int BulkInsertRecords<T>(this Database db, IEnumerable<T> collection, ISqlSyntaxProvider syntaxProvider, bool useNativeSqlPlatformBulkInsert = true)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Collections.Generic.IEnumerable<T> |
collection |
|
ISqlSyntaxProvider |
syntaxProvider |
|
System.Boolean |
useNativeSqlPlatformBulkInsert |
If this is false this will try to just generate bulk insert statements instead of using the current SQL platform's bulk
insert logic. For SQLCE, bulk insert statements do not work so if this is false it will insert one at a time.
|
Returns
Type |
Description |
System.Int32 |
The number of items inserted
|
Type Parameters
BulkInsertRecords<T>(Database, IEnumerable<T>, Transaction, Boolean)
Performs the bulk insertion in the context of a current transaction with an optional parameter to complete the transaction
when finished
Declaration
[Obsolete("Use the method that specifies an SqlSyntaxContext instance instead")]
public static void BulkInsertRecords<T>(this Database db, IEnumerable<T> collection, Transaction tr, bool commitTrans = false)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Collections.Generic.IEnumerable<T> |
collection |
|
Transaction |
tr |
|
System.Boolean |
commitTrans |
|
Type Parameters
BulkInsertRecords<T>(Database, IEnumerable<T>, Transaction, ISqlSyntaxProvider, Boolean, Boolean)
Performs the bulk insertion in the context of a current transaction with an optional parameter to complete the transaction
when finished
Declaration
public static int BulkInsertRecords<T>(this Database db, IEnumerable<T> collection, Transaction tr, ISqlSyntaxProvider syntaxProvider, bool useNativeSqlPlatformBulkInsert = true, bool commitTrans = false)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Collections.Generic.IEnumerable<T> |
collection |
|
Transaction |
tr |
|
ISqlSyntaxProvider |
syntaxProvider |
|
System.Boolean |
useNativeSqlPlatformBulkInsert |
If this is false this will try to just generate bulk insert statements instead of using the current SQL platform's bulk
insert logic. For SQLCE, bulk insert statements do not work so if this is false it will insert one at a time.
|
System.Boolean |
commitTrans |
|
Returns
Type |
Description |
System.Int32 |
The number of items inserted
|
Type Parameters
BulkInsertRecordsTry<T>(Database, IEnumerable<T>, Transaction, ISqlSyntaxProvider, Boolean, Boolean)
Declaration
public static int BulkInsertRecordsTry<T>(this Database db, IEnumerable<T> collection, Transaction tr, ISqlSyntaxProvider syntaxProvider, bool useNativeSqlPlatformBulkInsert = true, bool commitTrans = false)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Collections.Generic.IEnumerable<T> |
collection |
|
Transaction |
tr |
|
ISqlSyntaxProvider |
syntaxProvider |
|
System.Boolean |
useNativeSqlPlatformBulkInsert |
|
System.Boolean |
commitTrans |
|
Returns
Type |
Description |
System.Int32 |
|
Type Parameters
CreateDatabaseSchema(Database)
Creates the Umbraco db schema in the Database of the current Database.
Safe method that is only able to create the schema in non-configured
umbraco instances.
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static void CreateDatabaseSchema(this Database db)
Parameters
CreateDatabaseSchema(Database, Boolean)
Creates the Umbraco db schema in the Database of the current Database
with the option to guard the db from having the schema created
multiple times.
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static void CreateDatabaseSchema(this Database db, bool guardConfiguration)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Boolean |
guardConfiguration |
|
CreateTable(Database, Boolean, Type)
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static void CreateTable(this Database db, bool overwrite, Type modelType)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Boolean |
overwrite |
|
System.Type |
modelType |
|
CreateTable<T>(Database)
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static void CreateTable<T>(this Database db)where T : new ()
Parameters
Type Parameters
CreateTable<T>(Database, Boolean)
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static void CreateTable<T>(this Database db, bool overwrite)where T : new ()
Parameters
Type |
Name |
Description |
Database |
db |
|
System.Boolean |
overwrite |
|
Type Parameters
DropTable(Database, String)
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static void DropTable(this Database db, string tableName)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.String |
tableName |
|
DropTable<T>(Database)
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static void DropTable<T>(this Database db)where T : new ()
Parameters
Type Parameters
EscapeAtSymbols(String)
This will escape single @ symbols for peta poco values so it doesn't think it's a parameter
Declaration
public static string EscapeAtSymbols(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.String |
|
GetDatabaseProvider(Database)
Declaration
public static DatabaseProviders GetDatabaseProvider(this Database db)
Parameters
Returns
TableExist(Database, String)
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static bool TableExist(this Database db, string tableName)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.String |
tableName |
|
Returns
Type |
Description |
System.Boolean |
|
TableExist(UmbracoDatabase, String)
Declaration
[Obsolete("Use the DatabaseSchemaHelper instead")]
public static bool TableExist(this UmbracoDatabase db, string tableName)
Parameters
Returns
Type |
Description |
System.Boolean |
|
TruncateTable(Database, String)
Declaration
public static void TruncateTable(this Database db, string tableName)
Parameters
Type |
Name |
Description |
Database |
db |
|
System.String |
tableName |
|