C#: LINQ to SQL Database modular architecture

Question

I want to create a C# Project where I use a SQL Database and query it with LINQ, since it seems a little faster to implement than SQL Queries.

However I want to create a base script with hooks for plugins/modules. One of the hooks for the plugins should be, that they can create Database Tables for users and save Data into their created tables.

I found a Tutorial on how to create the Database without using the Designer. Tutorial: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/03/17/how-to-use-linq-to-sql-without-using-the-object-relational-designer.aspx

public class StoreDataContext : DataContext
{
    public Table<Product> Products;

    public StoreDataContext(string connection)
        : base(connection)
    {
    }
}

The Tables are properties of the DataContext class, but the modules would only be loaded at startup. Is there a way to include their Tables for the Database in my DataContext as well? Like add Properties to the Class during runtime and then call the DataContext.CreateDatabase() function?

TLDR: I want to load plugins during Runtime, but the Tables from the plugins should be included in the Database as well.

Best Regards


Show source
| c#   | database   | sql   | linq   2017-01-04 02:01 0 Answers

Answers ( 0 )

◀ Go back