Dapper-FluentMap icon indicating copy to clipboard operation
Dapper-FluentMap copied to clipboard

Even DatabaseGeneratedOption.Computed is used for property, FluentMap.Dommel still generates column and parameter names in insert\update query

Open enterpub opened this issue 4 years ago • 5 comments

.NET Core 3.1 Win 10 64 bit Dommel 2.1.0 Dapper 2.0.35 Dapper-FluentMap.Dommel 2.0.0

Even DatabaseGeneratedOption.Computed is used for property, Dapper.FluentMap.Dommel still generates column and parameter names in insert\update query, but it should skip them.

public sealed class DommelChargeMap : DommelEntityMap<ChargeDb>
    {
        public DommelChargeMap()
        {
            Map(x => x.RowVersion).SetGeneratedOption(DatabaseGeneratedOption.Computed);
        }
    }

But the insert and update has "RowVersion" and "@RowVersion" in result query.

How to archive not include such column in query?

enterpub avatar Sep 17 '20 20:09 enterpub

Can you show the Dapper.FluentMap initialization code. Did you call ForDommel() at application startup?

You can also try to use the [DontMap] or [Ignore] attribute on the property of the ChargeDb class. This will omit the column from insert/update statements without using Dapper.FluentMap.

henkmollema avatar Sep 22 '20 18:09 henkmollema

Hi, I do call ForDommel()

namespace MyCustom.Data.Client.Dommel
{
    using Dapper.FluentMap;
    using Dapper.FluentMap.Dommel;
    using MyCustom.Data.Client.Dommel.EntityMaps;
    using global::Dommel;

    public sealed class DommelForClientDatabase
    {
        public static void Setup()
        {
            FluentMapper.Initialize(config =>
            {
                config.AddMap(new DommelChargeMap());
                config.ForDommel();
            });
        }
    }
}

It is being called in Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
            services
                .AddControllersWithViews()
                .AddNewtonsoftJson();

           // .... other code removed for brevity

            DommelForClientDatabase.Setup();
 }

enterpub avatar Sep 22 '20 18:09 enterpub

This issue seems to be similar to #122

rsfurlan90 avatar Feb 12 '21 17:02 rsfurlan90

Is this bug fixed?

DanieleSky avatar Nov 23 '21 09:11 DanieleSky

@DanieleSky , I'm afraid it is not. But I did not check

enterpub avatar Nov 23 '21 10:11 enterpub

I'm archiving this repository as I'm not using this library myself anymore and have no time maintaining it. Thanks for using it.

henkmollema avatar Apr 19 '23 13:04 henkmollema