brucezhang80 / dapper-dot-net

Automatically exported from code.google.com/p/dapper-dot-net
Other
0 stars 0 forks source link

Unable to use Protected property as a parameter #89

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

When i try to reference protected property as a query parameter i get 
System.Data.SqlClient.SqlException : Must declare the scalar variable 
"@ProtectedProperty". The example code is below

public class EntityWithProtectedProperty
{
    protected string ProtectedProperty { get; set; }
}

[Test]
public void should_insert_protected_property()
{
    using (var connection = new SqlConnection())
    {
        connection.Execute("INSERT INTO Entities(Protected) VALUES (@ProtectedProperty)", new EntityWithProtectedProperty());
    }
}

What is the expected output? What do you see instead?
It should be possible to use protected properties as parameters like ti is 
possible to map them when reading data from database.

What version of the product are you using? On what operating system?
latest version on Windows 7

Please provide any additional information below.
If you're ok with expected behavior i can create and submit patch.

Original issue reported on code.google.com by vitaliy....@gmail.com on 20 Mar 2012 at 11:25