ossentoo
ossentoo

Reputation: 2019

servicestack sql server keyword not supported ormlite

I'm using servicestack in an api c# project and have referenced the

nuget packages.

I can connect to sql server as expected.

We are now trying to implement Always Encrypted colums in some of our sql server table columns. We append the following to our db connection strings:

";Column Encryption Setting=Enabled"

When running this line is c#:

var id = await Db.InsertAsync(customer, selectIdentity: true);

an exception is now raised:

"Keyword not supported: 'column encryption setting'."

This is probably because Always Encrypted isn't supported within the Ormlite package. Is there a way of implementing something similar with ServiceStack?

Upvotes: 2

Views: 210

Answers (1)

mythz
mythz

Reputation: 143319

This isn't an OrmLite error, it's coming from the System.Data.SqlClient ADO.NET Provider.

You'd need to use the ServiceStack.OrmLite.SqlServer.Data package which does reference the Microsoft.Data.SqlClient pacakge as suggested by the .NET Core reported Issue.

enter image description here

Which the decompiled sources shows us does reference the Microsoft.Data.SqlClient namespace:

enter image description here

If that doesn't work, see if you can open a connection directly with the Microsoft.Data.SqlClient SqlConnection class, e.g:

var conn = new SqlConnection(connectionString);
conn.Open();

Upvotes: 1

Related Questions