Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

SQL Server Compact Code Snippet of the Week #16 : detect Entity Framework database type

DZone 's Guide to

SQL Server Compact Code Snippet of the Week #16 : detect Entity Framework database type

· Performance Zone ·
Free Resource

This week's code snippet is prompted by a StackOverflow question, regarding how to detect if the database that was backing an Entity Framework DbContext was SQL Server Compact.

My proposed check simply uses the "is" operator to determine if the Database.Connection property is compatible with the SqlCeConnection class.

So my check is:

context.Database.Connection is SqlCeConnection
Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}