linq2db / LinqToDB.Identity

ASP.NET Core Identity provider that uses LinqToDB.
https://linq2db.github.io/
MIT License
46 stars 9 forks source link

SqlServer DatabaseConnection.CreateTable<> Adds "`1" #15

Open PARANOlD opened 5 years ago

PARANOlD commented 5 years ago

A startup.cs run in one of your samples includes a block for generating Identity tables using DataConnection.CreateTable<>. Table names for Identity (and any that are generic types) come out as `1.

I filtered the `1 out in the create process, but it only creates issues later when the ORM tries to access the tables. I also tried filtering them out and then generating a data context to attempt to override the type name interpretation process, but had no luck, the LinqToDB.Identity namespaced objects are still being used to access the database.

SqlException: Invalid object name 'IdentityUserClaim`1'. LinqToDB.Data.DataConnection.ExecuteReaderAsync(CommandBehavior commandBehavior, CancellationToken cancellationToken) in DataConnection.Async.cs

Would it be possible to change the way LinqToDb interprets type names so that no DB objects will not be created with `1 at the end of them?

ili commented 5 years ago

To fix it you should use Table attribute on your class

PARANOlD commented 5 years ago

I don't think that's an option without writing my own Identity provider. The Identity classes used for DB interactions are within the LinqToDb.Identity namespace.

On Thu, Nov 22, 2018, 1:03 AM Ilya Chudin <notifications@github.com wrote:

To fix it you should use Table https://linq2db.github.io/api/LinqToDB.Mapping.TableAttribute.html attribute on your class

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/linq2db/LinqToDB.Identity/issues/15#issuecomment-440932510, or mute the thread https://github.com/notifications/unsubscribe-auth/ADGjTvlNeZdhBV4lNsXQgTgtnxMcvs1Gks5uxkxSgaJpZM4Yt6Dy .