I'm starting to use RepoDb, but my SQL Server 2016 database has tables with a dot in the middle like this: User.Data
.
Moving from full .NET Entity Framework to RepoDb, I'm facing this issue. I'm using the fluent mapping and I wrote something like this:
FluentMapper
.Entity<UserData>()
.Table("[User.Data]")
.Primary(u => u.UserId)
I get the exception: MissingFieldsException
and it says:
There are no database fields found for table '[User.Data]'. Make sure that the target table '[User.Data]' is present in the database and/or at least a single field is available.
Just for curiosity, I created a table UserData
with the same attributes and primary key and it worked great (change the fluent mapper whit: .Table("[UserData]")
.
Am I missing something?
Thanks for helping me
The support to this in only available at RepoDb.SqlServer (v1.0.13) version or above. You can use either of the approaches below. Make sure to specify the quotes if you are using the database and schema.
Via built-in MapAttribute
.
[Map("[User.Data]")]
Via TableAttribute
of the System.ComponentModel.DataAnnotations
namespace.
[Table("[User.Data]")]
Via FluentMapper
as you did.
FluentMapper
.Entity<UserData>()
.Table("[User.Data]");