Checks if the primary key members in the database table correspond to the members marked as primary keys in the L2S model.
Namespace:
Huagati.DBMLTools.RuntimeAssembly: HuagatiDBMLToolsRTE (in HuagatiDBMLToolsRTE.dll) Version: 1.66.3362.23798
Syntax
C# |
---|
public static bool PKMembersCorrect( this MetaTable table, IDbConnection connection ) |
Visual Basic (Declaration) |
---|
<ExtensionAttribute> _ Public Shared Function PKMembersCorrect ( _ table As MetaTable, _ connection As IDbConnection _ ) As Boolean |
Visual C++ |
---|
[ExtensionAttribute] public: static bool PKMembersCorrect( MetaTable^ table, IDbConnection^ connection ) |
Parameters
- table
- Type: System.Data.Linq.Mapping..::.MetaTable
Linq-to-SQL MetaTable object for the table to validate primary key members for.
- connection
- Type: System.Data..::.IDbConnection
Database connection.
Return Value
True if the primary key members in the database are the same as in the model, false if not.
Examples
This example shows how to check if the primary key members in the database correspond to the primary key members in the L2S model.
CopyC#

using Huagati.DBMLTools.Runtime; public class MappingSample { public void Test() { SomeDataContext dc = new SomeDataContext(); //iterate through the collection of tables defined in the datacontext foreach (System.Data.Linq.Mapping.MetaTable table in dc.Mapping.GetTables()) { //check if PK members are correct if (table.PKMembersCorrect(dc.Connection)) { //pk members in the database matches PK members in the model } else { //pk members in the database does not match the PK members in the model } } } }