LINQ to SQL: using string filename to create a DataContext at runtime -
With FileInfo I can find the file name of a DataContext .dbml file.
provided I declare:
Dim DataModel = New feature mapping source (). GetModel (GetType ( Northwindetettentex ))
With System.Data.LINQ.Mapping I can find the name of all the tables and additionally their columns and relationships.
Thanks for all the excellent posts from Jomo Fischer: LINQ to SQL trick: Get all the tables [and columns] Name:
But without knowing the dataTontacted object I How can I get results? I mean how can I "replace it":
GetType (NorthwindetDettext) with
:
String = "Northwind DBML" dimmed mode = ... / ... GetType (myDCFile) as the slow myDCFile
You can try doing something like this:
assembly dataAssang = assembly Load ("yours .data. Assembly"); Datacontext type type = dataAssabankGetType (). FirstOther Default (x => x.IsSubclassOf (Datacontext));
You will basically load your data assembly and will first look for the data type which is a subtype of DataContext
.
You can then pass in your method:
Moderate DataModel = New Attribute MappingSource (). GetModel (Datacontax Type)
Mark
Comments
Post a Comment