SQL Server and Entity Framework
-
“IDENTITY_INSERT is already ON for table X” When Applied to Multiple Tables
Only one table per session can have IDENTITY_INSERT set to ON, which is why switching it on for several tables at once fails, and how to write the insert script instead.
-
Automatically Re-Create Stored Procedures In SQL Server
A cursor-based script that drops and recreates every stored procedure in a database, so stale dependency information in sysdepends is rebuilt.
-
Listing Objects Used in Stored Procedures (MS SQL)
A query over sysdepends and sysobjects that lists the tables, views, functions and procedures each stored procedure uses, for finding tables nobody references any more.
-
EF5 Migrations: Multiple Data Contexts in a Single Database
Entity Framework compares a data context against the single conceptual model in the migration history table, which is why several contexts in one database keep undoing each other.
-
Determine SQL Server Version and Edition
A one-line query using SERVERPROPERTY to read the product version, product level and edition of a SQL Server instance.
-
Getting The Database Connection String From an ObjectContext
Cast an ObjectContext's Connection to EntityConnection and read StoreConnection to reach the underlying database connection string.