always encrypted column

31 views
Skip to first unread message

Osman KOÇ

unread,
Aug 3, 2021, 2:47:58 PM8/3/21
to nhusers
Hi everyone.

I googled it a lot but i couldn't find a satisfactory answer to my issue.

how should i map always encrypted columns in fluent nhibernate?

i  have a colun  encrypted. it is ok with stored procs (i added Column Encryption Setting=enabled to my connectionstring) 

but with insert or updates i get this error;

SqlException: Operand type clash: varchar(8000) encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'CEK_Auto1', column_encryption_key_database_name = 'CC_DEMSA') collation_name = 'SQL_Latin1_General_CP1254_CI_AS' is incompatible with nvarchar(50) encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'CEK_Auto1', column_encryption_key_database_name = 'CC_DEMSA')
Statement(s) could not be prepared.

map.cs;

 
    public class TbTelFaxGsmMap : ClassMap<TbTelFaxGsm> {
        
        public TbTelFaxGsmMap() {
Table("TbTelFaxGsm");
LazyLoad();
Id(x => x.InTelFaxGsmId).GeneratedBy.Identity().Column("InTelFaxGsmId");
Map(x => x.StCustNo).Column("StCustNo");
Map(x => x.InTfgType).Column("InTfgType");
Map(x => x.InRecordOrder).Column("InRecordOrder");
Map(x => x.BoTrue).Column("BoTrue");
Map(x => x.InTelCountryCode).Column("InTelCountryCode");
Map(x => x.InTelCityCode).Column("InTelCityCode");
Map(x => x.StTfg).Column("StTfg");
                        Map(x => x.StNotes).Column("StNotes");
Map(x => x.InIsDisabled).Column("InIsDisabled");
        }
    }

domain.cs


    public class TbTelFaxGsm {
        public virtual int InTelFaxGsmId { get; set; }
        public virtual string StCustNo { get; set; }
        public virtual byte? InTfgType { get; set; }
        public virtual byte? InRecordOrder { get; set; }
        public virtual bool? BoTrue { get; set; }
        public virtual int? InTelCountryCode { get; set; }
        public virtual int? InTelCityCode { get; set; }
        public virtual string StTfg { get; set; }
        public virtual string StNotes { get; set; }
        public virtual int? InIsDisabled { get; set; }
    }

Thanks


Reply all
Reply to author
Forward
0 new messages