我希望在我的WCF服务中使用EF来获取数据并将其显示给客户端。 我需要以下建议:
Do I need to have the same interface for all the views (e.g. students, teachers etc.) or do I need to have a different interface and service for every table (or view)
Do I need to generate the database calls within my service (
.svc
) or some other architecture is preferred?public Student[] GetAllStudents() { //database generation code here }
How can I use EF code-first approach to generate database. I know that for an MVC app, you need to set the initializer in
Global.asax
or inweb.config
but I am not sure how it's called in this case. My model looks like this:[DataContract] public class Student { [DataMember] [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [DataMember] public string Type { get; set; } [DataMember] public string Subject { get; set; } [DataMember] public string Description { get; set; } }