pühapäev, 17. detsember 2017

SQL SERVER CLR serialization assembly

Kui juhtub, et SQL SERVER-i veebiteenuse poole pöörduv CLR hakkab pilduma viga

Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer. Please see inner exception for more information.  System.IO.FileLoadException: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host

Siis soovitatakse luua selle DLL jaoks ka Serialization assembly. Selleks tuleb antud projekt
VisualStudio 2015 kõigepealt signeerida



Serializer dll tegemiseks kasutab sgen.exe käsurida

sgen /force /compiler:/keyfile:c:\Campus\KampusPdfInvoice\KampusPFDInvoice.snk KampusPdfInvoice.dll

tulemusena tekib KampusPdfInvoice.XmlSerializers.dll fail, mis
tuleb andmebaasi sisse lugeda peale originaal DLL sisselugemist, ehk kõigepealt

CREATE ASSEMBLY [KampusPdfInvoice] ..

ja siis

CREATE ASSEMBLY [KampusPdfInvoice.XmlSerializers] ...