-
Notifications
You must be signed in to change notification settings - Fork 0
TableExtensions
Jacob Spitzer edited this page Aug 28, 2022
·
2 revisions
Handle table defenitions, create/modify/delete tables based on the code table classes, and compare between server database and code tables, and more.
Use Code First feature, or/and modify the database from the code, with just one or two lines of code.
Inheritance System.Object 🡒 TQueryTableExtensions
TQuery Extension Methods | |
---|---|
CreateTable<Table>(DbEc<Table>) | Creates a Table on the server database, based on the code table properties. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
CreateTableIfNotExists<Table>(DbEc<Table>) | Creates a Table on the server database if not exists, based on the code table properties. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
DropTable<Table>(DbEc<Table>) | Removes a Table from the server database. |
DropTableIfExists<Table>(DbEc<Table>) | Removes a Table from the server database if exists. |
GetDiffServerTableToCodeTable<Table>(DbEc<Table>) | Compares the server table and the code class with that table name, checks each field and their properties. |
ModifyTable<Table>(DbEc<Table>) | Modifies a table definition on the server database by altering, adding, or dropping columns and column datatypes, based on the code table properties. Available modifications: Add field, Remove field, Change field datatype. |
OverrideTable<Table>(DbEc<Table>) | Overrides a Table on the server database, based on the code table properties. Caution! This action will DELETE the current table on the Server with all the records, and then create a new blank Table with the current code properties. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
TQueryDb Extension Methods | |
---|---|
CreateAllTables(TQueryDatabase) | Creates all Tables on the server database, based on the code classes with [Table] attribute. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
CreateAllTablesIfNotExists(TQueryDatabase) | Checks each table if exists on the database, and creates the non-exists Tables on the server database, based on the code classes with [Table] attribute. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
DropAllTables(TQueryDatabase) | Removes all Tables on the server database, based on the code classes with [Table] attribute. |
GetAllServerDbTablesType(TQueryDatabase) | Returns a list of all table defenitions from the server database. |
GetDiffServerDbToCodeDb(TQueryDatabase) | Compares the server database and the code classes with [Table] attribute, checks each table and their fields and properties. |
IsEqualServerDbToCodeDb(TQueryDatabase) | Compares the server database and the code classes with [Table] attribute, checks each table and their fields and properties. |
TQueryExtended Extension Methods | |
---|---|
CreateTable<Table>(DbEcExtended<Table>) | Creates a Table on the server database, based on the code table properties. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
CreateTableIfNotExists<Table>(DbEcExtended<Table>) | Creates a Table on the server database if not exists, based on the code table properties. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
DropTable<Table>(DbEcExtended<Table>) | Removes a Table from the server database. |
DropTableIfExists<Table>(DbEcExtended<Table>) | Removes a Table from the server database if exists. |
ModifyTable<Table>(DbEcExtended<Table>) | Modifies a table definition on the server database by altering, adding, or dropping columns and column datatypes, based on the code table properties. Available modifications: Add field, Remove field, Change field datatype. |
OverrideTable<Table>(DbEcExtended<Table>) | Overrides a Table on the server database, based on the code table properties. Caution! This action will DELETE the current table on the Server with all the records, and then create a new blank Table with the current code properties. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
TQueryDbExtnded Extension Methods | |
---|---|
CreateAllTables(TQueryDatabaseExtended) | Creates all Tables on the server database, based on the code classes with [Table] attribute. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
CreateAllTablesIfNotExists(TQueryDatabaseExtended) | Checks each table if exists on the database, and creates the non-exists Tables on the server database, based on the code classes with [Table] attribute. Supported attributes are: [Key] for Primary Key, [AutoIncrement] for Auto Increment property, [Required] for Not Null property. |
DropAllTables(TQueryDatabaseExtended) | Removes all Tables on the server database, based on the code classes with [Table] attribute. |