Dodsworth
asked on
Get Mappings for a Given Table
I'm using this snippet of code...
Is there a way that I can specify the TableName (As String) to return the mappings for a given table ?
Using dc = New Context(ConnectionString)
Dim model = New System.Data.Linq.Mapping.AttributeMappingSource().GetModel(GetType(Context))
For Each mt In model.GetTable()
dBug(mt.TableName)
For Each dm In mt.RowType.DataMembers
dBug(" " + dm.MappedName + " " + dm.Type.ToString)
Next
Next
Is there a way that I can specify the TableName (As String) to return the mappings for a given table ?
ASKER
oops the code I posted was mid edit. It should have read..
I was hoping that there would be a way to get the table directly using model.GetTable. But this requires a CLR Row Type. I don't understand how a row type can return a metatable ?
For Each mt In model.GetTables()
I was hoping that there would be a way to get the table directly using model.GetTable. But this requires a CLR Row Type. I don't understand how a row type can return a metatable ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Using dc = New Context(ConnectionString)
Dim model = New System.Data.Linq.Mapping.A
For Each mt In model.GetTable()
if mt.TableName.ToLower = TableName.Tolower
dBug(mt.TableName)
For Each dm In mt.RowType.DataMembers
dBug(" " + dm.MappedName + " " + dm.Type.ToString)
Next
end if
Next
end sub