Using Entity Framework Code First CTP5, how do I create a primary key column that are INTs and are not identity columns

That answer didn’t work for me (in EF 4.1). To make this work, I added DatabaseGenerated attribute to my key column: public class FacebookUser { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public long FacebookId { get; set; } // … } Hope this helps someone.

using Guid as PK with EF4 Code First

Have you set Identity StoreGeneratedPattern? You can do it in the OnModelCreating method: modelBuilder.Entity<Foo>().Property(o => o.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); or using the DataAnnotation attributes: public class Foo { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id {get;set;} public string Name {get;set;} }

in entity framework code first, how to use KeyAttribute on multiple columns

You can specify the column order in the attributes, for instance: public class MyEntity { [Key, Column(Order=0)] public int MyFirstKeyProperty { get; set; } [Key, Column(Order=1)] public int MySecondKeyProperty { get; set; } [Key, Column(Order=2)] public string MyThirdKeyProperty { get; set; } // other properties } If you are using the Find method of a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)