Is it possible to access Linq to SQL mapping data without a DataContext instance?
I ask because I am writing some audit data generation code that will only trigger for some entities and some entity columns. I would like to fix up this meta data in a static constructor prior to any Linq DB access.
For example from a performance perspective it would be preferable to discover the primary key column of an entity just once instead of triggering the following code for each changed entity in the ChangeSet:
var metaTable = context.Mapping.GetTable(entityType);
var key = (PropertyInfo)metaTable.RowType.DataMembers.Single(
md => md.IsPrimaryKey).Member;
Prior to calling:
key.GetValue(entity, null),