Closed IvAlex1986 closed 8 years ago
You're probably missing the Dommel integration in your Dapper.FluentMap configuration. You have to call ForDommel()
on the configuration instance like this:
FluentMapper.Initialize(config =>
{
config
.AddMap(new AppCityListMap())
.ForDommel();
});
This registers the table and property name resolvers for Dommel using the mapping defined with Dapper.FluentMap. This behavior is implemented by the Dapper.FluentMap.Dommel package.
Please let me know if this resolves your issue.
Hi Henk,
I have this problem too, and I'm very sure I called config.ForDommel()
FluentMapper.Initialize(config =>
{
config.AddMap(new HotelMap());
config.ForDommel();
});
But there are a little different in entity class, it derived from a base class
public class Hotel : BaseEntity
{
public string Description { get; set; }
}
public class BaseEntity
{
public string Code { get; set; }
}
mapping class is
public class HotelMap : DommelEntityMap<Hotel>
{
public HotelMap()
{
ToTable("hotels");
Map(t => t.Description).ToColumn("des");
Map(t => t.Code).ToColumn("hotel_code");
}
}
If the Code
property defined in the Hotel
class, and everything is OK.
I use Dapper 1.50.2 + Dommel 1.6.1 + Dapper.FluentMap.Dommel 1.4.2, and also tried Dommel 1.7.1
Could you make it work with base class? Thanks.
@huhubun - I think that your problem might be fixed in Dapper.FluentMap 1.5.1 - see The corresponding Pull Request
@jmreynolds - I tried the version you mentioned, but it seems the issue hasn't been fixed, thanks anyway.
@huhubun there is a indeed an issue with derived entities. I still have to look into that...
@IvAlex1986 is your issue resolved? Please re-open if it's not.
Hello, We have the trouble with Dommel.
We use: MySQL 5.6.15 + Dapper 1.50.2 + Dommel 1.6.0 + Dapper.FluentMap.Dommel 1.4.0
Our Model:
Our Mapping class:
We have added mapper using next command:
We try to run query using next command:
But our SQL looks like this: select * from app_city_list where CityName = @p0 and CountryId = @p1 and StateId = @p2
And we have an error: Unknown column 'CityName' in 'where clause'
This error occurs because only City_Name column exists in our table app_city_list. Could you help with the problem of improper mapping work?