We are working with entity framework 4.1 - code first. We need to be able to name our constraints and not have their names auto-generated by SQL Server. Is this possible?<
Could you run some raw sql to rename them after creation? You may need to disable the EdmMetadata convention.
context.Database.ExecuteSqlCommand(
@"DECLARE @pk sysname
SELECT @pk = name FROM sysobjects WHERE parent_obj = object_id('users') and xtype = 'pk'
EXEC sp_rename @pk, 'pk_users_UserId'
");
The short answer is no. The longer answer is about meaning of the code first. Code-first means you are not interested in the database - you just let EF to create some and that is all what you need. It allows you defining names for tables and columns (it is useful especially when working with existing databases) but that is all.
If you need to work with database in such level you need database-first approach. Abusing code first to name constraints is possible but it is terribly hard and complex (it requires dropping old constraints after creation and create a new ones - example is here).