I have a project that mixes a compiled entity framework domain with dynamically defined external databases. Users can provide a connection string, table name, and column names at run time to access an external system. I used to use dynamically created SQL to access an external system (of course, with care to avoid SQL injection), and read the tables of interest in the DataTable and materialized them in POCO.
Now 90% of my views used IQueryable objects to check the structure of database queries and formatting / page / efficient view management. This allowed me to do enough work with the request before executing it. For views that are related to recordings from external systems, I just gritted my teeth and used IEnumerable.AsQueryable() .
I would very much like to use a different solution. I'm leaning towards Linq-to-SQL (I'm open to other suggestions), but I'm fixated on creating a dynamic MappingSource . In addition, some columns are optional, and I don't know if Linq-to-SQL will explode if I did not provide a mapping for each column or not.
public class ExternalMappingSource : MappingSource { public string[] KeyColumns { get; set; } public string NameColumn { get; set; } public string DescriptionColumn { get; set; } public string TimestampColumn { get; set; } protected override MetaModel CreateModel(Type dataContextType) {
I could not find good resources in this online mode. How to clear this class?
source share