I am building a library for Windows Phone 8 which requires local databases. Here is my understanding of how the LINQ-to-SQL works and creates database:
DataContextobject is created from the corresponding class.- When CreateDatabase() method is called, it reads the connection string and the members of type
Tablefrom the DataContext object. - The method creates database at given location and creates tables corresponding to the members of DataContext object.
Now, the DataContext class has to be hard typed. As I am building a library, I wouldn't know which tables the user will need. Obviously, I cannot use the hard typed DataContext. Moreover, CreateTable() method doesn't exist in this scenario. If I simply start using GetTable method, I get Table does not exist error.
The question is, how do I get create tables without using a hard typed DataContext?
P.S.: My situation is sort of similar to this.
DataContextfrom the user of library before issuing call toCreateDatabase()method. Would that work?