Question

I've a project that uses EF4 on the client side to talk to a SQL Server db. On that DB there's a bunch of SPs that do operations on records and return subsets of records. Nothing particularly major, about the most intensive bit is generating a few bytes of random data and overwriting part of a byte array with it. The records have to stay on the server for security reasons because the data array's akin to a private key.

In the past I've used ADO for DB access within the SPs, but that seems horribly outdated and clunky compared with EF4. And now that I've updated to SQL Server 2012 which has .NET4 available for SQLCLR stuff, I'd like to do the next SP using EF4 and shift to using that in the future.

Problem is, nobody seems to do it yet and I'm not sure it's possible yet.

I know I could do this by writing a seperate server-side app and having that talk to the the DB on my behalf, but that means the client side needs a connection both to the database and to the helper service. More things to get working, more things to go wrong, and aesthetically displeasing.

I've created a simple assembly that uses EF4 to give access to a couple of standard tables. No extra references added. On importing that into SQL Server, I get errors that it can't find "System.Data.Entity" and "System.Runtime.Serialization". Ok, I copy them into the same directory and import again. I get a couple of warnings that I'm in uncharted territory, which is fine for experimenting. But then I get a missing assembly "smdiagnostics". And I can't find any file on the drive that has "smdiagnostics" in the name, a full text search through the project for that term gives no hits, and I've not found much elsewhere that's helped me track down where this can be found.

So does anyone know how I can either satisfy or remove the requirement for smdiagnostics?

Was it helpful?

Solution

Ah. Bit of a "doh". Copying individual assemblies into the same directory as my own DLL isn't the way to go, just a knee jerk reaction to seeing an error message about the referenced assembles not being found even after looking in the same directory.

Assuming the use of the 32 bit server, having selected your own db and having already set trustworthy on, this registers everything needed in order to add an EF4 project;

 CREATE ASSEMBLY [System.Data.Entity] 
 from 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.Entity.dll'
 with permission_set = UNSAFE;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top