Entity Framework Code First: How to map SQL Server's computed columns into CF model?
问题 Is it possible to map computed columns into Code First model? I'd like to define computed columns with SQL Server and then map them as properties inside my CF model. Thanks in advance Best Regards 回答1: Use the DatabaseGenerated attribute with DatabaseGeneratedOption.Computed as the value [DatabaseGenerated(DatabaseGeneratedOption.Computed)] public string Foo { get; set; } 回答2: Not sure how you would do computed columns without using a view, and you cannot use views in EF Code First (you can