Reading from dynamically created tables with LINQ
We create tables in runtime. They have the same schema layout as tables that exist in our DBML but with an alternate name. We want to set the table names in runtime in our use of Linq to Sql.
Using wrapper classes on the Metadata as outlined in https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4233721&SiteID=1 works great for the updates, deletes and inserts.
Does anyone know how we can get the read of the alternate table to work?
You need to use an external mapping file. Populate the xml with the names of your table at runtime. This over-rides the attribute based mapping.
You need to new up your LINQ expression at run-time via System.Linq.Expressions