Explicit database table name

In case our model has a different name from table and we cannot use Code First Data Annotations, we can manually specify table name:

    string ConnectionString = "data source=.;initial catalog=myDB;integrated security=True";

    string tableName = "Clients";

    using(var tableDependency = new SqlTableDependency<Customers>(ConnectionString, tableName))
    {
        tableDependency.OnChanged += TableDependency_Changed;
        tableDependency.Start();

        Console.WriteLine("Waiting for receiving notifications...");
        Console.WriteLine("Press a key to stop");
        Console.ReadKey();
    }


This setting override Code First Data Annotations.

Last edited Nov 14, 2015 at 4:35 PM by delbianco, version 1