ここでは、Asp.Net の通常の Web フォームで、依存関係の挿入を使用してレコードを取得しています。ここでもEntity Frameworkを使用しました
以下に示すクラスとインターフェイスがあります。
public partial class Student
{
public Student()
{
}
public Student StudentID { get; set; }
public string StudentName { get; set; }
public string Address { get; set; }
}
public interface IStudentService
{
Student GetStudentsById(Student StudentID);
IList<Student> GetAllStudents();
}
コンテキスト クラスを作成しました
public partial class Entities : DbContext
{
public DbSet<Student> Students { get; set; }
}
次に、インターフェースを実装しました
public partial class StudentService : IStudentService
{
Entities db = new Entities();
public virtual Student GetStudentsById(Student StudentID)
{
//need to implement
}
public virtual IList<Student> GetAllStudents()
{
//need to implement
}
}
さて、これらのメソッドを実装するのを手伝ってくれる人はいますか
前もって感謝します