Exemplo n.º 1
0
        private static DbCompiledModel GetCompiledModel(DbConnection connection)
        {
            var builder = new DbModelBuilder(DbModelBuilderVersion.Latest);

            foreach (var entity in EntityTypeCache.GetEntitiesTypes(connection))
            {
                builder.RegisterEntityType(entity);
            }

            if (!(connection is SqlConnection)) // Compatible Effort. See https://effort.codeplex.com/workitem/678
            {
                builder.Conventions.Remove <ColumnAttributeConvention>();
            }

            var model = builder.Build(connection);

            return(model.Compile());
        }