Custom conventions don't handle '.'s in table names


create a sample application with one table in the DbContext
add convention: modelBuilder.Conventions.Add(e=>e.Configure(c=>c.toTable("test.Table")));
error: "The database name 'dbo.test.table' is invalid. Database names must be of the form [<schema_name>.]<object_name>."
Closed Jan 24, 2013 at 5:34 PM by lukew
Conventions now handle '.' in a manner consistent with other features, accepting a single period as a schema delimiter and then throwing an exception with more than one '.'


lukew wrote Oct 30, 2012 at 11:19 PM

In this case, test should be interpreted as the schema. the same behavior as calling ToTable from the fluent API

lukew wrote Oct 30, 2012 at 11:32 PM

This functionality is also broken with the [Table("Test.Table")] annotation

lukew wrote Oct 31, 2012 at 6:54 PM

More details:
on the first run of the application (when the database is created) have this convention enabled and add data to the database:
entities => entities
.Configure(c => c.ToTable(c.ClrType.Name)));

on the second run of the application change the convention to this:
entities => entities
.Configure(c => c.ToTable(c.ClrType.Name + ".table")));

note that without requiring any migration or having any initializers enabled the data in the database persists, but the table names change to reflect the new convention
also note: this change only works once and with an arbitrary number of '.' characters. i.e. ".table.test" works too

BriceLambson wrote Nov 14, 2012 at 9:24 PM

Fixed for conventions in Commit 4415b95af186.
Still need to address the issue on Table attributes.

BriceLambson wrote Dec 5, 2012 at 5:09 PM

Marking as fixed. The remaining work is being tracked by Work Item 716.