Obtaining the database schema, tables, columns, and primary keys in a single SQL call
I am currently writing an EntityFramework reverse engineer code-first generator. It will generate POCO classes, DbContext and Code First mapping for an existing database. There is one already in Entity Framework Power Tools Beta 2 However this one is going to do the job right, and include table filtering! Watch this space... SELECT [Extent1].[SchemaName], [Extent1].[Name] AS TableName, [Extent1].[TABLE_TYPE] AS TableType, [UnionAll1].[Ordinal], [UnionAll1].[Name] AS ColumnName, [UnionAll1].[IsNullable], [UnionAll1].[TypeName], ISNULL([UnionAll1].[MaxLength],0) AS MaxLength, ISNULL([UnionAll1].[Precision], 0) AS Precision, ISNULL([UnionAll1].[Default], '') AS [Default], ISNULL([UnionAll1].[DateTimePrecision], '') AS [DateTimePrecision], ISNULL([UnionAll1].[Scale], 0) AS Scale, [UnionAll1].[IsIdentity], [UnionAll1].[IsStoreGenerated], CASE WHEN ([Project5...