Skip to content
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

inheritance problem when using dapper.contrib #35

Open
thdotnet opened this issue Nov 7, 2019 · 0 comments
Open

inheritance problem when using dapper.contrib #35

thdotnet opened this issue Nov 7, 2019 · 0 comments

Comments

@thdotnet
Copy link

thdotnet commented Nov 7, 2019

Seems that if I have Foo model that inherits from Bar, when using Insert passing and instance of Foo, it's trying to insert into a Bar table.

public class Bar
{

}

public class Foo : Bar
{
   //properties
}

public class Repository
{
        public static void Insert<T>(string connectionString, T model) where T : Bar
        {
            using (var cnn = new SqlConnection(connectionString))
            {
                cnn.Open();
                cnn.Insert(model);
            }
        }
}
@NickCraver NickCraver transferred this issue from DapperLib/Dapper May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant