Closed rafakwolf closed 9 years ago
That exception is thrown by Dapper. It tries to map the Friends
property to a sql parameter, which is not supported since it's a complex type.
OK, but how can i ignore complex types on Insert and Update extension methods from Dommel ?
I made a pull request, please take a look.
Thanks alot!
This has nothing to do with Dommel. Dapper will try to map the complex type to a sql parameter, whether it exists in the sql query or not. Changing this on the side of Dommel won't fix your issue. I guess your best option is to create a dedicated class for update/insert with Dommel and Dapper.
With all respect i disagree. OK, but for what Dommel Mapping exists then ? If is capable to set the KeyField, then must be capable to set the Ignore fields to, isn't ?
Thanks alot
I guess you used Dapper.FluentMap.Dommel. This utility provides a mapping from database column names back to C# POCO properties when the result from the query is received. It's also used when Dommel builds SQL queries to map the POCO properties to column names. The Ignore
method is only used when mapping query results back to POCO's, not when building sql queries.
But the column names are used for build queries, isn't ?
Correct, perhaps it should also be used for that. But that won't fix your issue, since it occurs when Dapper is trying to map it to a database type. See: https://github.com/StackExchange/dapper-dot-net/blob/master/Dapper%20NET40/SqlMapper.cs#L910
I understand... but when i invoke Connection.Insert
Sorry for the insistence.
Ps.: Did you see my pull request ?
I think you're right, I'll have to look further into it.
This library is awesome, i would like to continue contributing
When i'm trying to make a Crud with this classes and ignore property Friends on Person class mapping, the "ignore" don't works with Dommel.
Error on insert method: "System.NotSupportedException: The member Friends of type Friend cannot be used as a parameter value".
Thanks in advance