-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mono.Data.Sqlite.SqliteException: SQLite error no such table: Employees #1422
Comments
Is the table called Employees?
…On Mon, 16 Mar 2020, 17:31 git_vb, ***@***.***> wrote:
Hi,
I have this weird error when I use contrib.extension
in this line:
Employee _get = con.Get<Employee>(1);
This is the code I'm using:
```
string cs = "Data Source==SqliteTest.db";
using (var con = new SqliteConnection(cs))
{
con.Open();
Employee _get = con.Get(1);
Log.Printi(_get);
}
and this is my class:
public class Employee
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
here some my imports:
using Mono.Data.Sqlite;
using Dapper.Contrib.Extensions;
If I don't use contrib.extension Dopper work fine.
What I'm missing?
Thank you
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1422>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMB5WRIVGH3AA5WR2JTRHZO6NANCNFSM4LMPCW3A>
.
|
This is the default behavior of .Contrib, to override the default plural, please use the [Table("Employee")]
public class Employee
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
} In Dapper v3, we aim to make this (and many similar scenarios) continue to work, but also be more customizable. |
It. work, I guess the only thing is to update your docs :) Thank you :) |
Hi I tried to set the table name as Employees in the database and to let the name Employee in the class. Thank you |
I don't follow your latest - if your table name is Employees, and the class name is |
You right :). I checked again and I missed a name check in DB that was made using nameof(classname) instead "TableName" ;) That was where my error came from.:) I noticed just now after reading your last post. I think I was tired last time hehe. |
Yep, looks like it's exactly that dumb: https://github.com/StackExchange/Dapper/blob/master/Dapper.Contrib/SqlMapperExtensions.cs#L299 I'll close this out to tidy up, but keep an eye on #722 where we're gonna improve this quite a bit for v3 :) |
Hi,
I have this weird error when I use contrib.extension
in this line:
Employee _get = con.Get<Employee>(1);
This is the code I'm using:
and this is my class:
here some my imports:
If I don't use contrib.extension Dopper work fine.
What I'm missing?
Thank you
The text was updated successfully, but these errors were encountered: